vear:注释多选
This commit is contained in:
@@ -98,21 +98,22 @@
|
|||||||
</radio-group>
|
</radio-group>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 地区(多选) -->
|
<!-- 地区 -->
|
||||||
<view v-if="activeTab === 'area'" class="content-section">
|
<view v-if="activeTab === 'area'" class="content-section">
|
||||||
|
<radio-group @change="(e) => handleSelect('area', e)">
|
||||||
<label
|
<label
|
||||||
v-for="option in areaOptions"
|
v-for="option in areaOptions"
|
||||||
:key="option.value"
|
:key="option.value"
|
||||||
class="radio-item"
|
class="radio-item"
|
||||||
:class="{ checked: selectedAreaValues.includes(String(option.value)) }"
|
:class="{ checked: selectedValues['area'] === String(option.value) }"
|
||||||
@click="toggleArea(String(option.value))"
|
|
||||||
>
|
>
|
||||||
<checkbox
|
<radio
|
||||||
:value="String(option.value)"
|
:value="String(option.value)"
|
||||||
:checked="selectedAreaValues.includes(String(option.value))"
|
:checked="selectedValues['area'] === String(option.value)"
|
||||||
/>
|
/>
|
||||||
<text class="option-label">{{ option.label }}</text>
|
<text class="option-label">{{ option.label }}</text>
|
||||||
</label>
|
</label>
|
||||||
|
</radio-group>
|
||||||
</view>
|
</view>
|
||||||
<!-- 底部按钮 -->
|
<!-- 底部按钮 -->
|
||||||
<view class="filter-footer">
|
<view class="filter-footer">
|
||||||
@@ -168,9 +169,6 @@ const selectedValues = reactive({
|
|||||||
area: ''
|
area: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
// 地区多选值(数组)
|
|
||||||
const selectedAreaValues = ref([]);
|
|
||||||
|
|
||||||
// 从字典获取的选项数据
|
// 从字典获取的选项数据
|
||||||
const educationOptions = ref([]);
|
const educationOptions = ref([]);
|
||||||
const experienceOptions = ref([]);
|
const experienceOptions = ref([]);
|
||||||
@@ -204,30 +202,17 @@ const handleSelect = (key, e) => {
|
|||||||
selectedValues[key] = e.detail.value;
|
selectedValues[key] = e.detail.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 切换地区多选
|
|
||||||
const toggleArea = (value) => {
|
|
||||||
const index = selectedAreaValues.value.indexOf(value);
|
|
||||||
if (index === -1) {
|
|
||||||
selectedAreaValues.value.push(value);
|
|
||||||
} else {
|
|
||||||
selectedAreaValues.value.splice(index, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 清除所有选择
|
// 清除所有选择
|
||||||
const handleClear = () => {
|
const handleClear = () => {
|
||||||
Object.keys(selectedValues).forEach((key) => {
|
Object.keys(selectedValues).forEach((key) => {
|
||||||
selectedValues[key] = '';
|
selectedValues[key] = '';
|
||||||
});
|
});
|
||||||
selectedAreaValues.value = [];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 确认筛选
|
// 确认筛选
|
||||||
const handleConfirm = () => {
|
const handleConfirm = () => {
|
||||||
const result = { ...selectedValues };
|
console.log('selectedValues:', selectedValues);
|
||||||
result.area = selectedAreaValues.value.join(',');
|
emit('confirm', selectedValues);
|
||||||
console.log('selectedValues:', result);
|
|
||||||
emit('confirm', result);
|
|
||||||
handleClose();
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user