微信小程序自定义组件1

1.创建component 2.生成文件添加相应内容 js: // pages/component/custom.js Component({ /**

    组件的属性列表 */ properties: { list: { // 属性名 type: String }, },

/**

    组件的初始数据 */ data: { value:‘20’, isList:‘哈哈哈哈哈啊哈’ },

/**

    组件的方法列表 */ methods: {

} }) html:

{ {value}} aaaaaaaaaaaaaaaaaaaaaaa 大学马上完事了 { {list}} json: { “component”: true, “usingComponents”: {} } 3.把相关内容传递给其他界面 4.需要引入自定义目录 “customs”:"/pages/component/custom"

经验分享 程序员 微信小程序 职场和发展