Commit 27fefd5a by 姜雷

修改取值过滤错误

parent 5aa81d76
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
v-model="value" v-model="value"
:list="list" :list="list"
:mapProps="{ :mapProps="{
key: 'id', key: 'areaId',
label:'label' label:'areaName'
}" }"
> >
<template <template
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
slot-scope="option" slot-scope="option"
> >
<div class="option-wrap"> <div class="option-wrap">
<span>{{option.data.label}}</span> <span>{{option.data.areaId}}</span>
<span>{{option.data.name}}</span> <span>{{option.data.areaName}}</span>
<span>{{option.data.label}}</span>
</div> </div>
</template> </template>
</ks-transfer> </ks-transfer>
<el-button @click="getData">刷新数据</el-button>
</list-layout> </list-layout>
</template> </template>
...@@ -27,22 +27,28 @@ export default { ...@@ -27,22 +27,28 @@ export default {
name: 'transferPage', name: 'transferPage',
data() { data() {
return { return {
list: [ list: [],
{ id: 1, label: '1111', name: '213' }, value: [],
{ id: 2, label: '2222', name: '213' },
{ id: 3, label: '3333', name: '213' },
{ id: 4, label: '3223', name: '213' },
{ id: 5, label: '5555', name: '213' },
{ id: 6, label: '6666', name: '213' },
{ id: 7, label: '7777', name: '213' },
{ id: 8, label: '8888', name: '213' },
{ id: 9, label: '9999', name: '213' },
{ id: 10, label: '1465', name: '213' },
{ id: 11, label: '2387', name: '213' },
],
value: [1, 3],
}; };
}, },
methods: {
getData() {
this.list = [
{ areaId: 22, areaName: '' },
{ areaId: 23, areaName: '新疆昌吉职业技术学院' },
{ areaId: 24, areaName: '沈阳药科大学溪湖校区' },
{ areaId: 25, areaName: '山东大学兴隆山校区' },
{ areaId: 26, areaName: '山东师范大学长清湖校区' },
{ areaId: 27, areaName: '山东交通学院长清校区' },
{ areaId: 29, areaName: '上海滢致校区' },
{ areaId: 35, areaName: '沈阳职业技术学院' },
{ areaId: 36, areaName: '嘉兴南洋职业技术学院浙江校区' },
{ areaId: 56, areaName: '长安区教育局' },
{ areaId: 15, areaName: '多彩温江校区' },
];
this.value = [];
},
},
}; };
</script> </script>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "rym-element-ui", "name": "rym-element-ui",
"version": "0.1.74", "version": "0.1.75",
"description": "任意门组件库", "description": "任意门组件库",
"main": "lib/rymUi.common.js", "main": "lib/rymUi.common.js",
"scripts": { "scripts": {
......
...@@ -177,7 +177,7 @@ export default { ...@@ -177,7 +177,7 @@ export default {
name: 'ks-transfer', name: 'ks-transfer',
props: { props: {
titles: Array, titles: Array,
list: Array, list: { type: Array, default: () => [] },
value: Array, value: Array,
onChange: Function, onChange: Function,
mapProps: { mapProps: {
...@@ -215,13 +215,15 @@ export default { ...@@ -215,13 +215,15 @@ export default {
}, },
computed: { computed: {
allDataOptions() { allDataOptions() {
return this.list let list = this.list.filter(
.filter(i => !this.trueValue.includes(i[this.mapProps.key])) i => !this.trueValue.includes(i[this.mapProps.key])
.filter(i => );
list = list.filter(i =>
this.filters.allValue this.filters.allValue
? i[this.mapProps.label].includes(this.filters.allValue) ? i[this.mapProps.label].includes(this.filters.allValue)
: i.label.includes(this.filters.allValue) : true
); );
return list;
}, },
selectDataOptions() { selectDataOptions() {
return this.list return this.list
...@@ -229,7 +231,7 @@ export default { ...@@ -229,7 +231,7 @@ export default {
.filter(i => .filter(i =>
this.filters.selectedValue this.filters.selectedValue
? i[this.mapProps.label].includes(this.filters.selectedValue) ? i[this.mapProps.label].includes(this.filters.selectedValue)
: i.label.includes(this.filters.selectedValue) : true
); );
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment