Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add samples #31

Merged
merged 29 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d271efc
update config envId, demoImg
TtTRz Apr 21, 2020
b2cdbc2
add samples: canvas2D, WebGL, VideoPictureInPicture
TtTRz Apr 21, 2020
9e71994
add samples: canvas2D, WebGL, VideoPictureInPicture
TtTRz Apr 21, 2020
a894673
add samples: canvas2D, WebGL, VideoPictureInPicture 9e71994 RomChung …
TtTRz Apr 21, 2020
5732aea
fix view missing tag
TtTRz Apr 22, 2020
8ca27eb
add samples: video-swiper, index-list, emoji
TtTRz Apr 22, 2020
0f30872
add samples: tabs, recycle-view, sticky
TtTRz Apr 22, 2020
d6c3612
add samples: barrage, wxml-to-canvas, select-text, toptips
TtTRz Apr 22, 2020
2c09313
add samples: aria-component, scroll-view, recycle-view, emoji, barrag…
TtTRz Apr 22, 2020
8275e35
add samples: audio, voice, background-audio
TtTRz Apr 23, 2020
7b51c44
add samples: mdns
TtTRz Apr 23, 2020
2159444
add samples: getBatteryInfo
TtTRz Apr 23, 2020
9480d3b
add samples: getBatteryInfo
TtTRz Apr 23, 2020
2c53141
add samples: getPerformance
TtTRz Apr 23, 2020
365a822
Add samples: BluetoothSlaveMode, getPerformance, UDPSocket
Apr 25, 2020
60598d0
Add samples: getBackgroundFetchData, getBackgtoundPrefetchData
Apr 26, 2020
2ba9027
Add samples: vtabs
Apr 26, 2020
1d1be70
Fix bugs
Apr 26, 2020
be9da55
Update samples
TtTRz Apr 28, 2020
230d7ef
Fix bugs
TtTRz Apr 29, 2020
599b106
Update Samples
TtTRz May 7, 2020
8b3de61
Fix getBackgroundFetchData Bugs
TtTRz May 7, 2020
dd336a3
Update internet image url
TtTRz May 7, 2020
40ed2d9
Update samples
TtTRz May 8, 2020
bd097d4
Update remote url
TtTRz May 8, 2020
0d4013a
no message
TtTRz May 11, 2020
aeb1233
update samples
TtTRz May 12, 2020
fb6b426
feat: update sample, add darkmode
TtTRz May 29, 2020
8f6d352
fix: npm 依赖位置
TtTRz Jun 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion cloudfunctions/getServerDataDemo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"dependencies": {
"wx-server-sdk": "latest"
}
}
}
2 changes: 1 addition & 1 deletion cloudfunctions/getTempFileURL/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"dependencies": {
"wx-server-sdk": "latest"
}
}
}
2 changes: 1 addition & 1 deletion cloudfunctions/wxContext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"dependencies": {
"wx-server-sdk": "latest"
}
}
}
39 changes: 39 additions & 0 deletions miniprogram/app-darkmode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"window": {
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#191919",
"backgroundColor": "#191919"
},
"tabBar": {
"color": "#FCFCFC",
"selectedColor": "#51A937",
"borderStyle": "white",
"backgroundColor": "#191919",
"list": [
{
"pagePath": "page/component/index",
"iconPath": "image/icon_component_HL.png",
"selectedIconPath": "image/icon_component_dark.png",
"text": "组件"
},
{
"pagePath": "page/weui/example/index",
"iconPath": "image/icon_component_HL.png",
"selectedIconPath": "image/icon_component_dark.png",
"text": "扩展能力"
},
{
"pagePath": "page/API/index",
"iconPath": "image/icon_API_HL.png",
"selectedIconPath": "image/icon_API_dark.png",
"text": "接口"
},
{
"pagePath": "page/cloud/index",
"iconPath": "image/icon_cloud_HL.png",
"selectedIconPath": "image/icon_cloud_dark.png",
"text": "云开发"
}
]
}
}
71 changes: 62 additions & 9 deletions miniprogram/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
const config = require('./config')

const themeListeners = []
global.isDemo = true
App({
onLaunch(opts) {

onLaunch(opts, data) {
const that = this;
const canIUseSetBackgroundFetchToken = wx.canIUse('setBackgroundFetchToken')
if (canIUseSetBackgroundFetchToken) {
wx.setBackgroundFetchToken({
token: 'getBackgroundFetchToken',
})
}
if (wx.getBackgroundFetchData) {
wx.getBackgroundFetchData({
fetchType: 'pre',
success(res) {
that.globalData.backgroundFetchData = res;
console.log('读取预拉取数据成功')
},
fail() {
console.log('读取预拉取数据失败')
wx.showToast({
title: '无缓存数据',
icon: 'none'
})
},
complete() {
console.log('结束读取')
}
})
}
console.log('App Launch', opts)
if (data && data.path) {
wx.navigateTo({
url: data.path,
})
}
if (!wx.cloud) {
console.error('请使用 2.2.3 或以上的基础库以使用云能力')
} else {
Expand All @@ -13,15 +45,36 @@ App({
})
}
},


onShow(opts) {
console.log('App Show', opts)
},
onHide() {
console.log('App Hide')
},
onThemeChange({ theme }) {
this.globalData.theme = theme
themeListeners.forEach((listener) => {
listener(theme)
})
},
watchThemeChange(listener) {
if (themeListeners.indexOf(listener) < 0) {
themeListeners.push(listener)
}
},
unWatchThemeChange(listener) {
const index = themeListeners.indexOf(listener)
if (index > -1) {
themeListeners.splice(index, 1)
}
},
globalData: {
theme: wx.getSystemInfoSync().theme,
hasLogin: false,
openid: null
openid: null,
iconTabbar: '/page/weui/example/images/icon_tabbar.png',
},
// lazy loading openid
getUserOpenId(callback) {
Expand All @@ -32,17 +85,17 @@ App({
} else {
wx.login({
success(data) {
wx.request({
url: config.openIdUrl,
wx.cloud.callFunction({
name: 'login',
data: {
code: data.code
action: 'openid'
},
success(res) {
success: res => {
console.log('拉取openid成功', res)
self.globalData.openid = res.data.openid
self.globalData.openid = res.result.openid
callback(null, self.globalData.openid)
},
fail(res) {
fail: err => {
console.log('拉取用户openid失败,将无法正常使用开放接口等服务', res)
callback(res)
}
Expand Down
Loading