使用vue2.0开发微信页面,使用weixinSDK调用wx.chooseImage时,微信的开发者工具显示正常,但手机点击按钮后无法正常打开相册(安卓测试,苹果未测试),vue的代码如下:
<template>
<div class="Picture">
<mu-flat-button label="选择" v-on:click.native="chooseImage" />
<img :src="localIds"/>
</div>
</template>
<script>
import wx from 'weixin-js-sdk'
import * as API from './PictureAPI.js'
export default {
name: 'Picture',
data () {
return {
localIds: ''
}
},
created () {
this.$http.get(
API.Get,
{ headers: { 'X-Requested-With': 'XMLHttpRequest' } }
).then((response) => {
wx.config({
debug: false,
appId: response.body.appId,
timestamp: parseInt(response.body.timestamp),
nonceStr: response.body.nonceStr,
signature: response.body.signature,
jsApiList: [
'chooseImage'
]
})
}, (response) => {
})
},
methods: {
chooseImage () {
wx.chooseImage({
success: function (res) {
// 运行不报错,但手机调试时就是不出现相册
console.log(res)
this.localIds = res.localIds
}
})
}
}
}
</script>
微信的开发者工具打印的内容为:
[JSSDK Info] chooseImage
input {"scene":"1|2","count":9,"sizeType":["original","compressed"],"sourceType":["album","camera"]};
output {"errMsg":"chooseImage:ok","localIds":["wxLocalResource://imageid123456789987654321","wxLocalResource://imageid987654321123456789"]}
求解答!!!
请问你的问题解决了吗
我也遇到了同样的问题呢