在微信小程序中定义页面变量的方法
1.首先,打开微信开发者工具,在小程序项目文件中打开一个wxs文件;
2.在文件中,定义一个变量var username,并赋值,表示页面变量;
var username = "null"
modul.exports.getweekday = getweek
3.最后,在其他页面使用console.log()方法调用变量即可;
console.log(username);
modul.exports.getweekday = getweek;
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:微信小程序如何添加一个图片到页面