2020-12-07 09:48:09 +08:00
|
|
|
Page({
|
2020-12-07 10:36:37 +08:00
|
|
|
onShareAppMessage() {
|
|
|
|
return {
|
|
|
|
title: '小程序官方组件展示',
|
|
|
|
path: 'page/component/index'
|
|
|
|
}
|
2020-12-07 09:48:09 +08:00
|
|
|
},
|
2020-12-07 10:36:37 +08:00
|
|
|
|
|
|
|
data: {
|
|
|
|
list: [
|
|
|
|
{
|
|
|
|
id: 'view',
|
|
|
|
name: '视图容器',
|
|
|
|
open: false,
|
|
|
|
pages: ['view', 'scroll-view', 'swiper']
|
|
|
|
}, {
|
|
|
|
id: 'content',
|
|
|
|
name: '基础内容',
|
|
|
|
open: false,
|
|
|
|
pages: ['text', 'icon', 'progress']
|
|
|
|
}, {
|
|
|
|
id: 'form',
|
|
|
|
name: '表单组件',
|
|
|
|
open: false,
|
|
|
|
pages: ['button', 'checkbox', 'form', 'input', 'label', 'picker', 'picker-view', 'radio', 'slider', 'switch', 'textarea']
|
|
|
|
}, {
|
|
|
|
id: 'nav',
|
|
|
|
name: '导航',
|
|
|
|
open: false,
|
|
|
|
pages: ['navigator']
|
|
|
|
}, {
|
|
|
|
id: 'media',
|
|
|
|
name: '媒体组件',
|
|
|
|
open: false,
|
|
|
|
pages: ['image', 'video']
|
|
|
|
}, {
|
|
|
|
id: 'canvas',
|
|
|
|
name: '画布',
|
|
|
|
open: false,
|
|
|
|
pages: ['canvas']
|
|
|
|
}, {
|
|
|
|
id: 'open',
|
|
|
|
name: '开放能力',
|
|
|
|
open: false,
|
|
|
|
pages: ['web-view']
|
|
|
|
}
|
|
|
|
]
|
2020-12-07 09:48:09 +08:00
|
|
|
},
|
2020-12-07 10:36:37 +08:00
|
|
|
|
|
|
|
kindToggle(e) {
|
|
|
|
const id = e.currentTarget.id
|
|
|
|
const list = this.data.list
|
|
|
|
for (let i = 0, len = list.length; i < len; ++i) {
|
|
|
|
if (list[i].id === id) {
|
|
|
|
list[i].open = !list[i].open
|
|
|
|
} else {
|
|
|
|
list[i].open = false
|
2020-12-07 09:48:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setData({
|
2020-12-07 10:36:37 +08:00
|
|
|
list
|
2020-12-07 09:48:09 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|