manifest.json(部分)
"versionName": 20211230,
"versionCode": 20211230,
APP.vue
plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
uni.request({
url: configSet.baseUrl + '/client-api/common/project/version/latest',
method: 'POST',
data: {
id: wechatUser.app_project_id,
},
success: (result) => {
var data = result.data ? result.data.data : {}
// 有新版本
console.log('本地版本', widgetInfo.version)
console.log('线上版本', data.version)
if((widgetInfo.version < data.version) && data.url) {
uni.downloadFile({
url: data.url,
success: (downloadResult) => {
if (downloadResult.statusCode === 200) {
plus.runtime.install(downloadResult.tempFilePath, {
force: true
}, function() {
console.log('install success...')
// 重启
plus.runtime.restart()
}, function(e) {
console.error('install fail...', e)
plus.nativeUI.toast('更新包安装失败,请重启应用后重试')
})
}
},
fail: (err) => {
console.log('下载失败', err)
plus.nativeUI.toast('更新包下载失败,请检查网络后重试')
}
})
} else {
console.log('暂无新版本')
}
}
})
})
tab1.vue(js)
console.log('新total_quantity', this.total_quantity)
console.log('新total_patient_quantity', this.total_patient_quantity)
this.$forceUpdate()
这里对应图片上为患者筹集药品那里的undefined,以及服务患者那里的undefined,控制台打印是有值的,加了 this.$forceUpdate()还是不会重新渲染
tab1.vue(html)
<view>new content 快快快嘿嘿嘿</view>
<view>new content 快快快</view>
<view>new content 快快快</view>
<view class="home-top">
<view class="content">
<bannerSwiper :dataArr="bannerSwiper"/>
</view>
</view>
bannerSwiper
<template>
<view class="swiper-banner">
<swiper class="swiper" :autoplay="true" @change="setDots" v-if="dataArr && dataArr.length > 0">
<swiper-item class="swiperItem" v-for="(item, index) in dataArr" :key="index" @click="Navgate(item.bannerUrl)">
<view class="swiper-item uni-bg-red">
<image :src="item.bannerImg" mode="widthFix" />
</view>
</swiper-item>
</swiper>
<view class="dotBox" v-if="dataArr && dataArr.length > 0">
<view class="dot" :class="{ active: currentIndex == index ? true : false }" v-for="(item, index) in dataArr" :key="index"></view>
</view>
</view>
</template>