Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
lls_program
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-09-03 22:04:10 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0b8ac3194d687bfb6666b228d5b8df299f1d4762
0b8ac319
1 parent
501ce5e4
fix(地区选择): 修复地区选择无效值时默认使用第一个区域
当selectedValue[0]为0或无效时,使用第一个区域作为默认值并确保转换为数字类型
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
src/pages/CreateFamily/index.vue
src/pages/EditFamily/index.vue
src/pages/CreateFamily/index.vue
View file @
0b8ac31
<!--
* @Date: 2025-08-27 17:44:53
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-0
2 21:40:15
* @LastEditTime: 2025-09-0
3 22:01:38
* @FilePath: /lls_program/src/pages/CreateFamily/index.vue
* @Description: 文件描述
-->
...
...
@@ -229,8 +229,17 @@ const isFormValid = computed(() => {
* @param {object} param0 - 包含 selectedValue 和 selectedOptions 的对象
*/
const onDistrictConfirm = ({ selectedValue, selectedOptions }) => {
selectedDistrict.value = selectedValue[0];
selectedDistrictText.value = selectedOptions.map((option) => option.text).join('');
// 如果selectedValue[0]为0或无效,使用第一个区域作为默认值
if (!selectedValue[0] || selectedValue[0] === 0) {
const firstDistrict = districtColumns.value[0];
selectedDistrict.value = firstDistrict.value;
selectedDistrictText.value = firstDistrict.text;
districtValue.value = [firstDistrict.value]; // 同步更新picker的值
} else {
selectedDistrict.value = +selectedValue[0]; // 确保转换为数字类型
selectedDistrictText.value = selectedOptions.map((option) => option.text).join('');
}
showDistrictPicker.value = false;
};
...
...
src/pages/EditFamily/index.vue
View file @
0b8ac31
<!--
* @Date: 2025-08-27 17:44:53
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-03 2
0:31:29
* @LastEditTime: 2025-09-03 2
1:59:36
* @FilePath: /lls_program/src/pages/EditFamily/index.vue
* @Description: 文件描述
-->
...
...
@@ -237,8 +237,17 @@ onMounted(async () => {
* @param {object} param0 - 包含 selectedValue 和 selectedOptions 的对象
*/
const onDistrictConfirm = ({ selectedValue, selectedOptions }) => {
selectedDistrict.value = selectedValue[0];
selectedDistrictText.value = selectedOptions.map((option) => option.text).join('');
// 如果selectedValue[0]为0或无效,使用第一个区域作为默认值
if (!selectedValue[0] || selectedValue[0] === 0) {
const firstDistrict = districtColumns.value[0];
selectedDistrict.value = firstDistrict.value;
selectedDistrictText.value = firstDistrict.text;
districtValue.value = [firstDistrict.value]; // 同步更新picker的值
} else {
selectedDistrict.value = +selectedValue[0]; // 确保转换为数字类型
selectedDistrictText.value = selectedOptions.map((option) => option.text).join('');
}
showDistrictPicker.value = false;
};
...
...
Please
register
or
login
to post a comment