修复bug
This commit is contained in:
@@ -57,12 +57,11 @@ const fetchHouseList = async () => {
|
||||
if (res.code === 200) {
|
||||
const list = res.rows || []
|
||||
houseList.value = list
|
||||
if (houseList.value.length > 0) {
|
||||
if (preSelectedHouseId.value) {
|
||||
const found = houseList.value.find(item => String(item.id) === String(preSelectedHouseId.value))
|
||||
selectedHouse.value = found || houseList.value[0]
|
||||
} else {
|
||||
selectedHouse.value = houseList.value[0]
|
||||
// 仅当从表单页带入了房屋ID时,自动选中对应房屋;否则不默认选择
|
||||
if (preSelectedHouseId.value) {
|
||||
const found = houseList.value.find(item => String(item.id) === String(preSelectedHouseId.value))
|
||||
if (found) {
|
||||
selectedHouse.value = found
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,7 +84,7 @@ const selectHouse = (item) => {
|
||||
|
||||
// 确认选择并返回
|
||||
const confirmSelect = () => {
|
||||
if (!selectedHouse.value) {
|
||||
if (!selectedHouse.value.id) {
|
||||
uni.showToast({ title: '请选择房屋', icon: 'none' })
|
||||
return
|
||||
}
|
||||
@@ -113,6 +112,8 @@ const confirmSelect = () => {
|
||||
}
|
||||
.house-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.house-item {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user