1.去github下载 iView Weapp 的dist文件夹,https://github.com/TalkingData/iview-weapp。
2.将下载好的dist文件夹放入要做的项目的根目录static下,同时将dist文件夹改名字为iview(不改也可以,我这里是为了区分)。
3.在src下面的main.js中写入下面代码
export default {
// 这个字段走 app.json
config: {
"usingComponents": {
"i-button": "../static/iview/button/index"
}
}
}
在vue文件中使用:
<div @click="tobrandList" class="head">
<i-button type="primary" bind:click="handleClick">这是一个按钮</i-button>
</div>
效果: