- 为啥我的翻页时钟代码转动一次后会有复原动画?求救!
Component({ properties: { countdown: { type: Object, value: null, observer(newVal, oldVal) { if (oldVal && newVal) { // 先保存前一个值用于动画 const { years, months, days, hours, minutes, seconds } = oldVal; // 更新 prev 数据 this.setData({ prevYears: years, prevMonths: months, prevDays: days, prevHours: hours, prevMinutes: minutes, prevSeconds: seconds // 确保这里是从 oldVal 中获取的 }); // 更新当前显示的值 this.setData({ currentYears: newVal.years, currentMonths: newVal.months, currentDays: newVal.days, currentHours: newVal.hours, currentMinutes: newVal.minutes, currentSeconds: newVal.seconds }); // 触发翻页动画 if (newVal.years !== oldVal.years) this.flip('Years'); if (newVal.months !== oldVal.months) this.flip('Months'); if (newVal.days !== oldVal.days) this.flip('Days'); if (newVal.hours !== oldVal.hours) this.flip('Hours'); if (newVal.minutes !== oldVal.minutes) this.flip('Minutes'); if (newVal.seconds !== oldVal.seconds) this.flip('Seconds'); // 更新当前显示的值 } } } }, data: { flipYears: false, flipMonths: false, flipDays: false, flipHours: false, flipMinutes: false, flipSeconds: false, prevYears: null, prevMonths: null, prevDays: null, prevHours: null, prevMinutes: null, prevSeconds: null, currentYears: null, currentMonths: null, currentDays: null, currentHours: null, currentMinutes: null, currentSeconds: null }, methods: { flip(unit) { const key = `flip${unit}`; this.setData({ [key]: true }); setTimeout(() => { this.setData({ [key]: false }); }, 600); }, } });
02-16 - 为啥我的tab栏指向页面的报错在两个信息之间反复横跳?
一开始提示 Error: app,json: ["tabBar"][1]["pagePath"]: "packageA/pages/about/about" need in ["pages"] File: app.json (您遇到的错误提示表明,在 [代码]app.json[代码] 文件的 [代码]tabBar[代码] 配置中指定的页面路径 [代码]"packageA/pages/about/about"[代码] 不在 [代码]pages[代码] 数组中定义。具体来说,[代码]tabBar[代码] 中引用的页面路径必须是在 [代码]app.json[代码] 文件的 [代码]pages[代码] 数组中声明过的路径。) 我就加了声明 subpackages,但是又出现提示 Error: app,json: ["pages"][1]: "packageA/pages/about/about" ShouId not exist in ["subPackages"][0]File: appjson 初学小白,请教,谢谢! 代码如下: { "pages": [ "pages/index/index" ], "subpackages": [ { "root": "packageA", "pages": [ "pages/preview/preview", "pages/about/about" ] } ], "tabBar": { "color": "#999999", "selectedColor": "#07C160", "backgroundColor": "#ffffff", "borderStyle": "black", "list": [ { "pagePath": "pages/index/index", "text": "首页", "iconPath": "images/home.png", "selectedIconPath": "images/home-active.png" }, { "pagePath": "packageA/pages/about/about", "text": "关于", "iconPath": "images/about.png", "selectedIconPath": "images/about-active.png" } ] },
01-25 - 可以使用excel库或者exceljs库 用来在小程序本地处理、导出的表格吗?
编程学习,尝试使用cursor写代码写本地小程序(不使用云开发)输出带图片的表格,这样可以吗? 老是会报错,报错信息如下 导出错误: Error: module 'miniprogram_npm/xlsx/stream.js' is not defined, require args is 'stream' at C (wxmodule.patch.js?t=wechat&s=1736591196863&v=2.19.4:1) at n (wxmodule.patch.js?t=wechat&s=1736591196863&v=2.19.4:1) at __REQUIRE__ (index.js:2) at index.js:809 at make_xlsx_lib (xlsx.js:24476) at Object.func (xlsx.js:24481) at __REQUIRE__ (index.js:2) at index.js:812 at index.js:812 at C (wxmodule.patch.js?t=wechat&s=1736591196863&v=2.19.4:1)(env: Windows,mp,1.06.2412040; lib: 2.19.4)
01-11