你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
模拟器里有内容,但是预览扫码后手机里为什么没有内容?// pages/index/index.js Page({ data: { dinnerOptions: [], result: "点击下方按钮开始抽取", suggestion: "", hasDrawn: false, isDrawing: false }, // 生命周期函数--监听页面加载 onLoad: function() { this.initDinnerOptions(); }, // 生命周期函数--监听页面显示 onShow: function() { // 确保每次页面显示时都有数据 if (!this.data.dinnerOptions || this.data.dinnerOptions.length === 0) { this.initDinnerOptions(); } }, // 初始化晚餐选项 initDinnerOptions: function() { console.log('初始化晚餐选项...'); // 使用异步方式获取存储数据 wx.getStorage({ key: 'dinnerOptions', success: (res) => { console.log('从存储获取的选项:', res.data); if (res.data && Array.isArray(res.data) && res.data.length > 0) { console.log('使用已保存的选项'); this.setData({ dinnerOptions: res.data }); } else { this.useDefaultOptions(); } }, fail: (err) => { console.log('获取存储失败:', err); this.useDefaultOptions(); } }); }, // 使用默认选项 useDefaultOptions: function() { const defaultOptions = ["烧烤", "火锅", "涮串", "烤肉"]; console.log('使用默认选项:', defaultOptions); this.setData({ dinnerOptions: defaultOptions }); // 异步保存默认选项到本地存储 wx.setStorage({ key: 'dinnerOptions', data: defaultOptions, success: () => { console.log('默认选项保存成功'); }, fail: (err) => { console.error('保存默认选项失败:', err); } }); }, // 保存选项到本地存储 saveOptions: function(options) { wx.setStorage({ key: 'dinnerOptions', data: options, success: () => { console.log('选项保存成功'); }, fail: (err) => { console.error('保存选项失败:', err); // 显示错误提示 wx.showToast({ title: '保存失败,请重试', icon: 'none' }); } }); }, // 添加新选项 addOption() { if (this.data.hasDrawn) { wx.showToast({ title: '已抽奖,无法修改选项', icon: 'none' }); return; } wx.showModal({ title: '添加晚餐选项', editable: true, placeholderText: '请输入新的晚餐选项', success: (res) => { if (res.confirm) { const newOption = res.content.trim(); if (!newOption) { wx.showToast({ title: '选项不能为空', icon: 'none' }); return; } const options = this.data.dinnerOptions || []; if (options.includes(newOption)) { wx.showToast({ title: '该选项已存在', icon: 'none' }); return; } const newOptions = options.concat(newOption); this.setData({ dinnerOptions: newOptions }); // 保存到本地存储 this.saveOptions(newOptions); wx.showToast({ title: '选项添加成功', icon: 'success', duration: 1500 }); } } }); }, // 删除选项 deleteOption(e) { if (this.data.hasDrawn) { wx.showToast({ title: '已抽奖,无法修改选项', icon: 'none' }); return; } const index = e.currentTarget.dataset.index; const options = this.data.dinnerOptions; if (options.length <= 2) { wx.showToast({ title: '至少保留两个选项', icon: 'none' }); return; } wx.showModal({ title: '确认删除', content: `确定要删除"${options[index]}"吗?`, success: (res) => { if (res.confirm) { options.splice(index, 1); this.setData({ dinnerOptions: options }); // 保存到本地存储 this.saveOptions(options); wx.showToast({ title: '删除成功', icon: 'success' }); } } }); }, // 随机抽取晚餐 drawDinner() { if (this.data.isDrawing) return; const options = this.data.dinnerOptions; if (options.length < 2) { wx.showToast({ title: '请至少添加两个选项', icon: 'none' }); return; } this.setData({ isDrawing: true, hasDrawn: false, result: "正在抽取..." }); let count = 0; const maxCount = 20; // 转动次数 const interval = 50; // 初始间隔时间(毫秒) const roll = () => { const randomIndex = Math.floor(Math.random() * options.length); const currentOption = options[randomIndex]; this.setData({ result: currentOption }); if (count < maxCount) { count++; // 逐渐增加间隔时间,使动画变慢 const nextInterval = interval + (count * 10); setTimeout(roll, nextInterval); } else { this.setData({ isDrawing: false, hasDrawn: true, suggestion: `今晚就吃${currentOption}吧!` }); } }; roll(); }, // 重置抽取 resetDraw() { this.setData({ hasDrawn: false, result: "点击下方按钮开始抽取", suggestion: "" }); // 确保本地存储中的选项是最新的 this.saveOptions(this.data.dinnerOptions); }, // 抽取按钮按下效果 handleDrawBtnTouchStart() { this.setData({ ['drawBtnActive']: true }); }, // 抽取按钮释放效果 handleDrawBtnTouchEnd() { this.setData({ ['drawBtnActive']: false }); }, // 重置按钮按下效果 handleResetBtnTouchStart() { this.setData({ ['resetBtnActive']: true }); }, // 重置按钮释放效果 handleResetBtnTouchEnd() { this.setData({ ['resetBtnActive']: false }); } }); [图片][图片] 这种问题是怎么回事呀?
06-14立刻生效
scheme配置新路径后多久能生效?scheme配置新路径后多久能生效?
06-12请提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
微信更新到最新版后,图片预览一直转圈?如题,原来的版本好好的,更新到最新版就不行了,啥情况,使用的是uni.previewImage?
06-12请提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
微信版本更新到最新后,图片预览不了?原来的版本没问题,更新到最新之后就预览不了了,多个人试了之后都是这样。使用的是uni.previewImage
06-12测试未复现,请提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
wx.previewImage在安卓微信8.0.60版本上点开就是黑屏转圈只要是安卓微信8.0.60的版本只要预览图片必复现
06-12你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
camera组件调用startRecord录制视频报错?现在IOS设备在调用startRecord之前,如果先播放一段视频,就会报这个错误 "errMsg": "operateCamera:fail audio device start fail"
06-12[图片]
{"errcode":87009,"errmsg":"invalid signature rid:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/checkSessionKey.htmlhttps://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/checkSessionKey.html
06-12就医助手支持主体类型为事业单位的公立医院,主体类型为政府的卫健委的公众号与小程序开通使用。看不到入口,应该是主体不符合
城市服务中没有就医助手,怎么开通https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/cityservice/medicalassistant.html
06-11不能
城市服务的小程序,可以在用户没有订阅小程序的情况下,给用户发消息吗?我的小程序入驻到城市服务,用户产生了费用;但是用户没有订阅小程序,城市服务或微信可以提醒用户进行缴费吗?比如说水电费、快递费等等
06-11在正式版打开调试还有一种方法,就是先在开发版或体验版打开调试,再切到正式版就能看到vConsole
小程序本地调试能正常运行,但发布上线后,一直网络错误,请问有可能是什么原因?小程序本地调试能正常运行,但发布上线后,一直网络错误,请问有可能是什么原因?
06-11