产线转运

This commit is contained in:
2026-03-19 14:04:42 +08:00
parent 78d20c178b
commit 7e9bbb01b2
2 changed files with 19 additions and 3 deletions

View File

@@ -98,10 +98,11 @@
}, },
// 使用 onShow 确保每次进入页面(包括从后台切回)都能读取最新的缓存值 // 使用 onShow 确保每次进入页面(包括从后台切回)都能读取最新的缓存值
onShow() { onShow() {
this._getRegion()
this.loadSelectedValue(); this.loadSelectedValue();
}, },
created () { created () {
this._getRegion() // console.log(2)
}, },
methods: { methods: {
async _getRegion () { async _getRegion () {

View File

@@ -96,8 +96,13 @@
onLoad (options) { onLoad (options) {
this.title = options.title this.title = options.title
}, },
created () { // 使用 onShow 确保每次进入页面(包括从后台切回)都能读取最新的缓存值
onShow() {
this._getRegion() this._getRegion()
this.loadSelectedValue();
},
created () {
// console.log(2)
}, },
methods: { methods: {
async _getRegion () { async _getRegion () {
@@ -105,7 +110,6 @@
let res = await getRegion() let res = await getRegion()
if (res) { if (res) {
this.options2 = res this.options2 = res
this.index2 = res[4].value
} else { } else {
this.options2 =[] this.options2 =[]
} }
@@ -113,11 +117,22 @@
this.options2 = [] this.options2 = []
} }
}, },
// 从缓存加载选中的值
loadSelectedValue() {
if (uni.getStorageSync('selectedSiteType2')) {
this.index = uni.getStorageSync('selectedSiteType2')
}
if (uni.getStorageSync('selectedMbqy2')) {
this.index2 = uni.getStorageSync('selectedMbqy2')
}
},
selectChange (e) { selectChange (e) {
this.index = e this.index = e
uni.setStorageSync('selectedSiteType2', e)
}, },
selectChange2 (e) { selectChange2 (e) {
this.index2 = e this.index2 = e
uni.setStorageSync('selectedMbqy2', e)
}, },
clearUp () { clearUp () {
this.val1 = '' this.val1 = ''