nvue页面在uniapp中使用的注意事项
其他 458
1.不支持绑定在原型链上的方法
解决方法:直接在nvue页面上导入
实例代码:
<script>
import $U from "@/common/js/index.js"
import $A from "@/api/index.js"
export default {
data() {
return {
screenHeight: uni.getSystemInfoSync().screenHeight
}
},
methods: {
toHomePage() {
uni.switchTab({
url: '/pages/tabbar/home/home'
})
},
toLoginPage() {
uni.reLaunch({
url: '/pages/login/login'
})
},
async checkLogin() {
try{
$U.notice('已登录')
this.toHomePage()
}catch(e){
$U.notice('请登录')
this.toLoginPage()
}
}
},
async onLoad() {
await this.checkLogin()
}
}
</script>