mpvue引入iview weapp的组件库

版权声明:本文为QQ帝国原创博客,转载请附上链接,谢谢。 https://blog.csdn.net/QQ_Empire/article/details/88578542

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


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


 二、引进iview weapp的组件库

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

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

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

 

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

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

扫描二维码关注公众号,回复: 6049450 查看本文章

 三、具体页面的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"
  }
}

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

    <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>

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


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

猜你喜欢

转载自blog.csdn.net/QQ_Empire/article/details/88578542
今日推荐