自定义组件

1.新建component

2.使用

2.1 在json中加入

"usingComponents": {
    "comp":"/components/comp/comp"
  }

2.2 html使用

<comp></comp>

3.自定义属性值

3.1 在自定义组件的js中

/**
   * 组件的属性列表
   */
  properties: {
    mytitle:{
      type:String,
      value:""
    }

  },

3.2 在自定义组件的wxml中

<view>{{mytitle}}</view>

3.3 使用

<title mytitle="str"></title>
posted @ 2022-10-04 20:07  lwx_R  阅读(16)  评论(0)    收藏  举报