微信小程序 demo / 开发工具 / 文档资源
为了方便更新, 后续资源全部更新到 wiki
官方已经提供了,无需破解了,具体看以下链接。
官方文档: https://mp.weixin.qq.com/debug/wxadoc/dev/?t=1474643026176
开发工具: https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html?t=1474644089359
📱微信小程序 demo
微信小程序 demo / 开发工具 / 文档资源
为了方便更新, 后续资源全部更新到 wiki
官方已经提供了,无需破解了,具体看以下链接。
官方文档: https://mp.weixin.qq.com/debug/wxadoc/dev/?t=1474643026176
开发工具: https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html?t=1474644089359
表现就是到蓝色之后点一下依然是蓝色(最后一个)
但是点第二下会直接到红色(第二个)
看了一下循环那边实现有点诡异,order可以不需要为5个的
只用在tap的for循环里面对scrollView的长度取余就可以了
组件中:
组件中:
scrollToTop: function(e) {
this.setData({
scrollTop: 0
})
}
var util = require('../../../util/util.js')
var playTimeInterval,interval
Page({
data: {
...
},
startRecord: function () {
...
},
stopRecord: function () {
wx.stopRecord()
this.setData({recording:false,recordTime:0,formatedRecordTime: '00:00:00'})
clearInterval(interval)
},
...
onUnload:function(){
this.stopRecord()
console.log("voice page has been unloaded!")
}
})
播放背景音乐进度丢失问题
方法:
/page/API/background-audio/background-audio.js 重写了一些方法
Page({
onLoad: function () {
var that = this
...
// 进入的时候应该检测后台是否有音乐正在播放
checkPlaying()
function checkPlaying() {
wx.getBackgroundAudioPlayerState({
success: function (res) {
console.log("播放器状态:",res)
console.log("初始化时的webview",that.data.__webviewId__)
var _isPlaying,_playTime
res.status === 1?
_isPlaying = true:_isPlaying = false
res.currentPosition/res.duration > 0.95?
_playTime = 0:_playTime = res.currentPosition
that.setData({
playing:_isPlaying,
playTime: _playTime,
formatedPlayTime: util.formatTime(_playTime)
})
if(_isPlaying)
that._enableInterval()
}
})
}
},
...
})
Pager({
...
resume:function(){
var that = this
if(this.updateInterval != '')
clearInterval(this.updateInterval)
wx.playBackgroundAudio({
dataUrl: dataUrl,
title: 'Lost Stars',
coverImgUrl: 'http://y.gtimg.cn/music/photo_new/T002R150x150M000000Jhxf24CFL06.jpg?max_age=2592000',
complete: function () {
that.setData({
playing:true
})
wx.seekBackgroundAudio({
position: that.data.playTime,
complete:function(){
console.log("resume ok")
}
})
}
})
},
...
})
Page({
onLoad: function () {
...
// 设置播放停止监听事件
wx.onBackgroundAudioStop(function () {
console.log("音乐停止了,当前webview: ",that.data.__webviewId__)
that.setData({
playing: false,
playTime: 0,
formatedPlayTime: '00:00:00'
})
})
// 设置播放开始监听事件
wx.onBackgroundAudioPlay(function(){
console.log("音乐开始了,当前webview: ",that.data.__webviewId__)
// 开始后需要更新当前歌曲的秒数
if(that.data.playing === false)
that.setData({
playing:true
})
if(that.updateInterval >= 0)
return
that._enableInterval()
})
// 设置播放暂停监听事件
wx.onBackgroundAudioPause(function(){
console.log("音乐暂停了,当前webview: ",that.data.__webviewId__)
// 暂停后,不需要继续更新歌曲秒数
if(that.data.playing === true)
that.setData({
playing:false
})
if(that.updateInterval >= 0)
clearInterval(that.updateInterval)
})
...
},
4) 同时在wxml中增加了重播的按键(文字的形式),简单的在两个block中加入
<block wx:if="{{playing === true}}">
<view class="page-body-button" bindtap="stop">
<image src="/image/stop.png"></image>
</view>
<view class="page-body-button" bindtap="pause">
<image src="/image/pause.png"></image>
</view>
<view class="page-body-button" bindtap="play">
<text class="restart">重播</text>
</view>
</block>
<block wx:if="{{playing === false}}">
<view class="page-body-button"></view>
<view class="page-body-button" bindtap="resume">
<image src="/image/play.png"></image>
</view>
<view class="page-body-button" bindtap="play">
<text class="restart">重播</text>
</view>
</block>
.page-body-button .restart{
line-height: 80px;
}
在修复背景音乐一些小bug的过程中,我发现,首先进入播放音乐界面播放歌曲,再返回上一个界面,这时候如果再进入播放音乐界面,那么播放器的功能没有问题,但是在该页面中用于更新UI的定时器会按进出次数递增。
稍后发PR~
VM1306:1 Mon Jan 08 2018 16:28:10 GMT+0800 (**标准时间) WXML 文件编译错误
VM1306:2 ./page/API/get-user-info/get-user-info.wxml
unexpected tag, near wx-imag...
14 |
15 |
16 | wx-image class="userinfo-avatar" src="{{userInfo.avatarUrl}}">
| ^
17 | {{userInfo.nickName}}
18 |
19 |
看意思就是个chrome基础上的东西,应该有吧
page/component/index bindtab=“widgetsToggle”
pageData.widgetsToggle = function (e) {
console.count('tab on ' + e.timeStamp);
var id = e.currentTarget.id, data = {};
for (var i = 0, len = type.length; i < len; ++i) {
data[type[i] + 'Show'] = false;
}
data[id + 'Show'] = !this.data[id + 'Show'];
this.setData(data);
};
环境
mbp
开发工具版本: v0.9.092300
这个页面中 https://github.com/xwartz/wechat-app-demo/wiki
运行demo这一段 里 ,applyID 我随便了,一直提示 是无效ID,这怎么办?
<view class="body">
<view class="widgets">
***
TypeError: Cannot read property 'MaxRequestConcurrent' of undefined
at http://1214303409.appservice.open.weixin.qq.com/asdebug.js:1:5840
at http://1214303409.appservice.open.weixin.qq.com/asdebug.js:1:9997(anonymous function) @ asdebug.js:1(anonymous function) @ asdebug.js:1
WAService.js:2 App: onLaunch have been invoked
~~!
图片在选择拍照,拍照后点击使用屏幕就什么都消失了。
是需要把这些组件样式引用进去么?
有个微信小程序外包,接吗,不是特别多的功能
扫描登录, 然后出现错误:please bind your wechat account to the appid first
Demo 下载
https://pan.baidu.com/s/1mi4iwZY 密码: 1zpu
This is a broken link.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.