
1、首先引进iview weapp的组件库https://weapp.iviewui.com/docs/guide/start
2、将下载的包dist文件下拷贝到自己的项目
3、官网是将需要使用的组件,按照小程序的自定义封装组件的方式,将所需要的组件封装成小程序的自定义的组件,然后通过usingComponents的方式将你需要的组件引进来。
下面是一些例子:
pages/logs/index.vue(此处是文件的路径):
<template>
<div class="followRecords">
<i-button @click="handleClick">默认按钮</i-button>
<i-button @click="handleClick" type="error" long="true">联通两边按钮</i-button>
<i-button @click="handleClick" type="primary">Primary</i-button>
<i-button @click="handleClick" type="ghost">Ghost</i-button>
<i-button @click="handleClick" type="info">Info</i-button>
<i-button @click="handleClick" type="success">Success</i-button>
<i-button @click="handleClick" type="warning">Warning</i-button>
<i-button @click="handleClick" type="error">Error</i-button>
</div>
</template>
<script>
export default {
name: 'followRecords',
data () {
return {
}
},
mounted () {
},
methods: {
handleClick(e) {
console.log(e);
}
}
}
</script>
<style lang="scss">
.followRecords {
}
</style>
pages/logs/main.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"
}
}