mpvue
中引入iview weapp
步骤
(一)从github
官网下载iview weapp
文件
(二)将dist
文件夹下所有文件,复制到项目文件中的static
文件夹中
这里我在static
文件夹中将dist
文件命名为iview
,你们可以随意起名。
(三)在要使用的组件中,新建main.json
文件,在json
文件中引入相应组件
{
"navigationBarTitleText": "首页",
"navigationBarBackgroundColor": "#000",
"usingComponents": {
"i-card": "../../../static/iview/card/index",
"i-steps": "../../../static/iview/steps/index",
"i-step": "../../../static/iview/step/index",
"i-button": "../../../static/iview/button/index",
"i-divider": "../../../static/iview/divider/index",
"i-panel": "../../../static/iview/panel/index",
"i-toast": "../../../static/iview/toast/index",
"i-message": "../../../static/iview/message/index",
"i-icon": "../../../static/iview/icon/index",
"i-cell-group": "../../../static/iview/cell-group/index",
"i-cell": "../../../static/iview/cell/index",
"i-grid": "../../../static/iview/grid/index",
"i-grid-item": "../../../static/iview/grid-item/index",
"i-grid-icon": "../../../static/iview/grid-icon/index",
"i-grid-label": "../../../static/iview/grid-label/index",
"i-row": "../../../static/iview/row/index",
"i-col": "../../../static/iview/col/index",
"i-tag": "../../../static/iview/tag/index",
"ec-canvas": "../../../static/ec-canvas/ec-canvas"
}
}
(四)然后在页面中使用标签就可成功调用
<i-button bind:click="handleClick"
type="primary">Primary</i-button>
<i-button bind:click="handleClick"
type="ghost">Ghost</i-button>
<i-button bind:click="handleClick"
type="info">Info</i-button>