vue props 与 computed 属性名称重复 bug All In One
vue props 与 computed 属性名称重复 bug All In One
vue props 与 computed 属性名称重复会自动进行合并覆盖 (顺序 ?)
❌ 不会合并
demo
<TopFilter
:filterData="filterData"
:options="options"
@change="handleChangeFilter"
@refresh="refreshData"
/>
computed: {
options () {
return [
{
type: 'select',
key: 'regionIds',
icon: 'statusbar-area',
filterable: false,
propsMapper: {
label: 'name',
value: 'id',
},
datalist: this.regionList,
},
];
},
filterParams () {
return {
region_id: this.filterData.regionIds,
};
},
},
<template>
<TableTopFilter
:options="options"
:filterData="innerFilterData"
/>
</template>
<script>
import TableTopFilter from '@/views/components/TableTopFilter';
export default {
name: 'TopFilter',
props: {
filterData: Object,
},
components: {
Table2TopFilter
},
data () {
return {
gameList: [],
};
},
computed: {
options () {
return [
{
type: 'select',
exposedKey: 'region',
key: 'regionIds',
filterable: false,
},
];
},
},
methods: {},
mounted () {
// vue props 与 computed 属性名称重复,回自动合并覆盖 (顺序 ?)
console.log('this.options', this.options);
}
};
</script>
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/15818017.html
未经授权禁止转载,违者必究!