This commit is contained in:
yanran200730
2022-07-28 16:56:22 +08:00
parent 05fea73a62
commit 83fe4f8854
2 changed files with 13 additions and 0 deletions

View File

@@ -311,6 +311,8 @@
if (res.code === 0) { if (res.code === 0) {
const data = res.data.result.now const data = res.data.result.now
alert(JSON.stringify(data))
uni.setStorageSync('address', { uni.setStorageSync('address', {
...uni.getStorageSync('address'), ...uni.getStorageSync('address'),
weather: `${data.text} ${data.temp}°` || '' weather: `${data.text} ${data.temp}°` || ''

View File

@@ -79,6 +79,17 @@
if (v.address) { if (v.address) {
this.address = uni.getStorageSync('address').address || '' this.address = uni.getStorageSync('address').address || ''
this.weather = uni.getStorageSync('address').weather || '' this.weather = uni.getStorageSync('address').weather || ''
this.configList = JSON.parse(JSON.stringify(this.config)).map(v => {
if (v.fieldType === '3') {
v.defaultValue = uni.getStorageSync('address').address || ''
}
if (v.fieldType === '2') {
v.defaultValue = uni.getStorageSync('address').weather || ''
}
return v
})
} }
}, },
deep: true deep: true