小程序调用不同页面函数的案例:函数写在对应的js文件,代码如下:function fORMatTime(date) {var year = date.getFullYear()var&nbs
小程序调用不同页面函数的案例:
函数写在对应的js文件,代码如下:
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
function formatNumber(n) {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime,
}
在其他页面中调用的代码如下:
collegeChoiceTap:function(e){
if(this.data.index !==e.detail.value){
console.log(getApp().globalData.college_change) 。
getApp().get_a_test()
this.setData({
index: e.detail.value
})
}
}
--结束END--
本文标题: 小程序怎么调用不同页面的函数
本文链接: https://www.lsjlt.com/news/116438.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
2024-05-16
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0