xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-01-18 15:25  xgqfrms  阅读(288)  评论(1编辑  收藏  举报