-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathindex.js
154 lines (147 loc) · 4.54 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
Page({
onShow() {
wx.reportAnalytics('enter_home_programmatically', {})
// http://tapd.oa.com/miniprogram_experiment/prong/stories/view/1020425689866413543
if (wx.canIUse('getExptInfoSync')) {
console.log('getExptInfoSync expt_args_1', wx.getExptInfoSync(['expt_args_1']))
console.log('getExptInfoSync expt_args_2', wx.getExptInfoSync(['expt_args_2']))
console.log('getExptInfoSync expt_args_3', wx.getExptInfoSync(['expt_args_3']))
}
if (wx.canIUse('reportEvent')) {
wx.reportEvent('expt_event_1', {expt_data: 1})
wx.reportEvent('expt_event_2', {expt_data: 5})
wx.reportEvent('expt_event_3', {expt_data: 9})
wx.reportEvent('expt_event_4', {expt_data: 200})
wx.reportEvent('weexpt_event_key_1', {option_1: 1, option_2: 10, option_str_1: 'abc'})
wx.reportEvent('weexpt_event_key_1', {option_1: 'abc', option_2: '1000', option_str_1: '1'})
}
},
onShareAppMessage() {
return {
title: '小程序官方组件展示',
path: 'page/component/index'
}
},
onShareTimeline() {
'小程序官方组件展示'
},
data: {
list: [
{
id: 'view',
name: '视图容器',
open: false,
pages: ['view', 'scroll-view', 'swiper', 'movable-view', 'cover-view']
}, {
id: 'content',
name: '基础内容',
open: false,
pages: ['text', 'icon', 'progress', 'rich-text']
}, {
id: 'form',
name: '表单组件',
open: false,
pages: ['button', 'checkbox', 'form', 'input', 'label', 'picker', 'picker-view', 'radio', 'slider', 'switch', 'textarea', 'editor']
}, {
id: 'nav',
name: '导航',
open: false,
pages: ['navigator']
}, {
id: 'media',
name: '媒体组件',
open: false,
pages: ['image', 'video', 'camera', 'live-pusher', 'live-player']
}, {
id: 'map',
name: '地图',
open: false,
pages: ['map', { appid: 'wxe3f314db2e921db0', name: '腾讯位置服务示例中心'}]
}, {
id: 'canvas',
name: '画布',
open: false,
pages: ['canvas-2d', 'webgl']
}, {
id: 'open',
name: '开放能力',
open: false,
pages: ['ad', 'open-data', 'web-view']
}, {
id: 'obstacle-free',
name: '无障碍访问',
open: false,
pages: ['aria-component']
}
// 迁移到交互动画tab(第二个)
// , {
// id: 'Skyline',
// name: 'Skyline 渲染引擎',
// open: false,
// pages: [
// { url: 'worklet/animation/index', name: 'worklet 动画'},
// { url: 'worklet/gesture/index', name: '手势系统'},
// { url: 'share-element/list/index', name: '共享元素动画'},
// { url: 'worklet/bottom-sheet/index', name: '手势协商'},
// { key: 'custom-route', url: 'half-page/scale-page/index', name: '自定义路由' },
// { url: 'address-book/index', name: '类通讯录'},
// { url: 'half-screen/index', name: '半屏'},
// { url: 'tabs/index', name: 'tabs'},
// { key: 'custom-route', url: 'album/index', name: '相册'},
// { key: 'custom-route', url: 'custom-route/index', name: '星巴克自定义路由'},
// ]
// }, {
// id: 'XRFrame',
// name: 'XRFrame 高性能XR解决方案',
// open: false,
// pages: [
// { url: 'pages/index/index', name: '总览'}
// ]
// }
],
theme: 'light'
},
onUnload() {
if (wx.offThemeChange) {
wx.offThemeChange()
}
},
onLoad() {
this.setData({
theme: wx.getSystemInfoSync().theme || 'light'
})
if (wx.onThemeChange) {
wx.onThemeChange(({theme}) => {
this.setData({theme})
})
}
},
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
}
}
this.setData({
list
})
wx.reportAnalytics('click_view_programmatically', {})
},
navToDoc(e) {
wx.navigateTo({
url: '/packageComponent/pages/doc-web-view/doc-web-view',
})
},
// 打开自定义路由页面
goToCustomRoute: function goToCustomRoute(evt) {
const { url } = evt.currentTarget.dataset
wx.navigateTo({
routeType: 'ScaleTransition',
url: `/packageSkyline/pages/${url}`
});
},
})