| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <template>
- <view class="version-info-page">
- <u-cell-group :border="false" customStyle="background:#ffffff">
- <u-cell title="当前版本号(正式版)" :value="userInfo.version || '无'" />
- <u-cell
- title="检测更新"
- :value="userInfo.updateStatus || '无'"
- :border="false"
- @click="checkForUpdates"
- />
- </u-cell-group>
- </view>
- </template>
- <script setup>
- import { reactive } from 'vue'
- const userInfo = reactive({
- version: 'v_2024050400_1', // Example version number
- updateStatus: '已经是新版本' // Example update status
- })
- function checkForUpdates() {
- // Simulate checking for updates
- setTimeout(() => {
- const newVersionAvailable = true; // Simulate a new version check
- if (newVersionAvailable) {
- userInfo.updateStatus = '发现新版本,正在下载...';
- downloadNewVersion();
- } else {
- userInfo.updateStatus = '已经是新版本';
- }
- }, 1000);
- }
- function downloadNewVersion() {
- // Simulate downloading the new version
- setTimeout(() => {
- userInfo.updateStatus = '下载完成,准备安装';
- // Add logic to install the new version if needed
- }, 2000);
- }
- </script>
- <style>
- .version-info-page {
- padding: 20rpx;
- border-radius: 20rpx;
- }
- </style>
|