mpvue引入iview weapp的组件库

废话不多说,直接上步骤。。。


一、首先建好一个mpvue模板(具体看mpvue文档)

mpvue引入iview weapp的组件库_第1张图片


 

 二、引进iview weapp的组件库

(下载weapp链接:https://github.com/TalkingData/iview-weapp

   1、下载完了以后就得到了一个压缩包

    2、解压后打开这个文件,看到一个dist文件夹 

mpvue引入iview weapp的组件库_第2张图片 

    3、把dist文件夹内东西全部copy到你项目中的static的文件下的iview文件夹

      (这里我新建个iview的子文件)

mpvue引入iview weapp的组件库_第3张图片


 

 三、具体页面的main.json配置

mpvue引入iview weapp的组件库_第4张图片

{
  "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"
  }
}

 

四、 在具体需要用到的页面就可以用iview weapp提供的标签组件了

mpvue引入iview weapp的组件库_第5张图片

    
默认按钮 联通两边按钮 Primary Ghost Info Success Warning Error

 

五、重新执行npm run dev命令,然后就可以看到iview组件已生效。

mpvue引入iview weapp的组件库_第6张图片


 

六、全剧终,续集持续拍摄中,敬请关注......

你可能感兴趣的:(vue,vue-iview,小程序)