微信小程序引用自定义组件

在微信小程序官方文档中的扩展能力模块,有weui的组件库。

我们可以在这里下载组件,以slideview为例。

在小程序根目录下新建components文件夹,下载cell、cells、slideview放到该文件夹中,

在需要使用组件的页面的json文件中加上

{
  "usingComponents": {
    "mp-cells": "../components/cells/cells",
    "mp-cell": "../components/cell/cell",
    "mp-slideview": "../components/slideview/slideview"
  }
}

在页面上加入组件的wxml和js,即可使用该组件。

原文地址:https://www.cnblogs.com/luoyihao/p/12718279.html