H5W3
当前位置:H5W3 > uniapp技术问答专区 > 正文

plus.io 操作文件后调用扫一扫或者进入包含video的.nvue 报错 [JS Framework] Failed to find taskCenter (xx)

    <view class="content">
<image class="logo" src="https://ask.dcloud.net.cn/static/logo.png" @click="goHome"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
</view>
</template>
<script>
// #ifdef APP-PLUS
import handleCache from "@/common/cache.js"
import permision from '@/common/permission.js';
//#endif
export default {
data() {
return {
title: 'Hello',
list: [1, 2, 3, 4, 5, 6]
}
},
onLoad() {
this.pageInit()
},
methods: {
goHome() {
console.log("home");
uni.navigateTo({
url: '/pages/home/home'
})
},
async pageInit() {
let cacheData = await handleCache.getCache("cache_test", "test", this.list);
if (!cacheData) {
setTimeout(() => {
handleCache.saveCache("cache_test", "test", this.list);
}, 2000)
}
console.log(cacheData);
},
async scan() {
// #ifdef APP-PLUS
let status = await this.checkPermission();
if (status !== 1) {
return;
}
// #endif
// #ifndef H5
uni.scanCode({
success: res => {
console.log(res);
},
fail: err => {
// #ifdef MP
uni.getSetting({
success: res => {
let authStatus = res.authSetting['scope.camera'];
if (!authStatus) {
uni.showModal({
title: '授权失败',
content: '微微需要使用您的相机,请在设置界面打开相关权限',
success: res => {
if (res.confirm) {
uni.openSetting();
}
}
});
}
}
});
// #endif
}
});
// #endif
},
// #ifdef APP-PLUS
async checkPermission(code) {
let status = permision.isIOS ? await permision.requestIOS('camera') : await permision.requestAndroid(
'android.permission.CAMERA');
if (status === null || status === 1) {
status = 1;
} else {
uni.showModal({
content: '需要相机权限',
confirmText: '设置',
success: function(res) {
if (res.confirm) {
permision.gotoAppSetting();
}
}
});
}
return status;
},
// #endif
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
_分割线_________________________________________________________
详细代码在压缩包中 可以去调试下  如有代码问题请告知

未经允许不得转载:H5W3 » plus.io 操作文件后调用扫一扫或者进入包含video的.nvue 报错 [JS Framework] Failed to find taskCenter (xx)

赞 (0)

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址