You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1 KiB
Vue

<template>
<view class="setting-page">
<ch-nav-bar :height="66" title="设置"></ch-nav-bar>
<uni-list>
<uni-list-item title="版本更新" show-arrow="true" clickable @click="checkAppUpdate">
<template v-slot:footer>
<uni-tag v-if="hadUpdate" text="新版本" type="primary"></uni-tag>
<text v-else>{{ appInfo.appWgtVersion }}</text>
</template>
</uni-list-item>
</uni-list>
</view>
</template>
<script setup>
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import { reactive, ref, toRefs } from 'vue';
import { useSystemStore } from '@/store/system.js';
const sysStore = useSystemStore();
console.log(sysStore)
const data = reactive({
hadUpdate: false,
appInfo: sysStore.appInfo
})
const { hadUpdate, appInfo } = toRefs(data);
// 检查更新
function checkAppUpdate () {
// #ifdef APP
uni.showLoading({
title: '检查更新...'
})
checkUpdate().then(res => {
console.log('检查更新结果:', res)
}).catch(error => {
console.log("检查更新错误:", error)
}).finally(() => {
uni.hideLoading()
})
// #endif
}
</script>
<style lang="scss">
</style>