开发微信小程序中,为了符合开发需求自定义了 “折叠栏“、“普通表格“、“遮罩弹层”组件,已独立抽取出来的组件作出以下总结,便于后续在其他小程序项目中使用
github地址:https://github.com/HeaventTso/zayer-miniprogram
"usingComponents": {
"zayer-flod" : "组件存放路径/zayer-flod/index"
}
<zayer-flod title="折叠栏标题" expand="{{true}}" withIcon="{{ true }}" withAttach="{{ true }}" stopFlod="{{ false }}">
<image slot="icon" src="" />
<text slot="title_right" >备注信息</text>
<view slot="content">
-----------
折叠内容区域
-----------
</view>
</zayer-flod>
属性变量备注:
expand: Boolean 默认false,是否展开
withIcon: Boolean 默认false,是否带图标
withAttach: Boolean 默认false,是否附带右侧按钮或备注
stopFlod: Boolean 默认false,是否禁止展开
多slot说明
可自定义图标,需声明带 slot="icon" 的wxml结构
<image slot="icon" src="" />
可自定义右侧附属信息,如文字或按钮,需声明 slot="title_right" 的wxml结构
<text slot="title_right" >备注信息
折叠内容定义
<view slot="content">
内容
</view>
"usingComponents": {
"zayer-table": "../../component/zayer-table/index"
}
<zayer-table table="{{ demoTable }}" custom-class="demoClass">
data: {
demoTable: {
thead: [
{ title: "姓名", col: "name" },
{ title: "年龄", col: "age" },
{ title: "性别", col: "gender" },
{ title: "地址", col: "address" },
],
tbody: [
{ name: "heavent", age: 24, gender: "男", address: "深圳" },
{ name: "lucy", age: 23, gender: "女", address: "广州" },
{ name: "jeremy", age: 22, gender: "男", address: "惠州" },
{ name: "tommy", age: 22, gender: "男", address: "东莞" }
]
}
}
"usingComponents": {
"zayer-mask": "../../component/zayer-mask/index"
}
<zayer-mask show="{{ showFlag }}" custom-class="demoClass">
<view slot="title">标题
<view slot="dialog">
内容
</view>
</zayer-mask>
data: {
showFlag: true
}
属性说明
show: 是否显示遮罩层
custom-class: 自定义属性
多slot说明
title:标题wxml结构
dialog:主要显示内容wxml结构