<template>
<view>
<view @tap="MyRenderjsModule.eventChange" style="width: 300rpx;height: 120rpx;background-color: rgb(0, 255, 0);display: flex;justify-content: center;align-content: center;align-items: center;">Click Me, Please</view>
<view :prop="mainTag" :change:prop="MyRenderjsModule.mainTagUpdate"></view>
</view>
</template>
<script module="MyRenderjsModule" lang="renderjs">
export default {
data() {
return {
renderTag: ''
}
},
mounted() {
},
methods: {
mainTagUpdate(newVal, oldVal, ownerInstance, instance) {
console.log(`renderTag will update form ${oldVal} to ${newVal} by prop mainTag`)
this.renderTag = newVal
let mainTag = ''
// #ifdef APP-PLUS
mainTag = plus.storage.getItem('mainTag')
// #endif
// #ifndef APP-PLUS
mainTag = uni.getStorageSync('mainTag')
// #endif
console.log(`mainTagUpdate call cache mainTag = ${mainTag}`)
},
eventChange(event, ownerInstance) {
console.log(`Event "eventChange" triggered`)
ownerInstance?.callMethod('mainCallBack', {param: 'abc'})
},
},
}
</script>
<script>
export default {
data() {
return {
mainTag: ''
}
},
onLoad(options) {
setInterval(()=>{
this.mainTag = (new Date()).toString()
// #ifdef APP-PLUS
plus.storage.setItem('mainTag', this.mainTag)
// #endif
// #ifndef APP-PLUS
uni.setStorageSync('mainTag', this.mainTag)
// #endif
}, 3000)
},
methods: {
mainCallBack(obj = {}){
console.log(`Event "mainCallBack" triggered by renderjs call "mainCallBack"`)
}
}
}
</script>
<style>
</style>

herenowts
- 发布:2023-05-16 15:20
- 更新:2024-07-09 11:36
- 阅读:466
renderjs 使用记录
分类:uni-app
2 个评论
要回复文章请先登录或注册
超级无敌APP
aak12345