wuqy-component
Version:
这是一个微信小程序自定义组件库
55 lines (52 loc) • 1.08 kB
text/typescript
// components/showcase/index.ts
Component({
options: {
multipleSlots: true, // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {},
/**
* 组件的初始数据
*/
data: {
//true展示商品详细信息。
show: false,
},
pageLifetimes: {
show: function () {
// 页面被展示
},
hide: function () {
// 页面被隐藏
},
resize: function (size: any) {
// 页面尺寸变化
},
},
/**
* 组件的方法列表
*/
methods: {
//点击内容会自动展开详细的商品描述。
contentUnfold() {
if (!this.data.show) {
this.setData({
show: true,
});
} else {
this.setData({
show: false,
});
}
},
},
lifetimes: {
// 在组件实例进入页面节点树时执行
attached: function () {},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
},
});