This commit is contained in:
PQZ 2024-08-07 18:16:02 +08:00
parent 14404f023e
commit a271a410e2
2 changed files with 67 additions and 133 deletions

View File

@ -1,12 +1,18 @@
<template> <template>
<div class="block"> <div class="block">
<el-cascader v-model="selectedOptions" placeholder="请选择" :options="options" :filter-method="handleFilter" <!-- <el-cascader v-model="selectedOptions" placeholder="请选择" :options="options" :filter-method="handleFilter"-->
:debounce="500" :show-all-levels="false" filterable clearable /> <!-- :debounce="500" :show-all-levels="false" filterable clearable/>-->
<el-cascader
placeholder="请选择品牌型号"
:options="options"
filterable></el-cascader>
</div> </div>
</template> </template>
<script> <script>
import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api'; import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api';
export default { export default {
watch: { watch: {
selectedOptions(newVal, oldVal) { selectedOptions(newVal, oldVal) {
@ -19,11 +25,11 @@ export default {
methods: { methods: {
// //
handleFilter(node, keyword) { handleFilter(node, keyword) {
debugger
console.log(keyword, 'Filtering:'); console.log(keyword, 'Filtering:');
// //
this.getData(keyword); this.getData(keyword);
// this.options = // this.options =
// const filteredOptions = [ // const filteredOptions = [
// { // {
// value: 'filtered1', // value: 'filtered1',
@ -50,89 +56,17 @@ export default {
} }
CarBrandSelectorApi.searchBrand(param).then(res => { CarBrandSelectorApi.searchBrand(param).then(res => {
this.options = res.data this.options = res.data
this.options = res.data
}); });
}, },
changedOptionsForTest() {
this.options = [{
value: 'zhinan',
label: '指北',
children: [{
value: 'shejiyuanze',
label: '指北1',
children: [{
value: 'yizhi',
label: '一致',
children: [{
value: 'sadme',
label: 'how sad me'
}]
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '指北2',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
},]
},
}, },
data() { data() {
return { return {
selectedOptions: [], // selectedOptions: [], //
options: [{ options: [], //
value: 'zhinan',
label: '指北',
children: [{
value: 'shejiyuanze',
label: '指北1',
children: [{
value: 'yizhi',
label: '一致',
children: [{
value: 'sadme',
label: 'how sad me'
}]
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '指北2',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
},], //
}; };
} }

View File

@ -71,7 +71,7 @@
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button> <el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</div> </div>
<CarBrandSelector/> <CarBrandSelector ref="brandForm"/>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>