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

vue inject computed bug All In One

vue inject computed bug All In One

shit code 💩

reactive inject ???inject

export default {
    name: 'CustomFilter',
    inject: {
        parentCustomConfig: 'customConfig',
        parentFilterData: 'filterData',
    },
    computed: {
        customConfig () {
            return this.parentCustomConfig();
        },
        filterData () {
            return this.parentFilterData();
        },
     },
};

good code ✅

export default {
    name: 'CustomFilter',
    inject: [
        'customConfig',
        'filterData',
    ],
};

provide/inject

https://vuejs.org/v2/guide/components-edge-cases.html#Dependency-Injection

https://vuejs.org/v2/api/#provide-inject

refs

https://github.com/vuejs/vue/issues/7017



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-12-09 14:15  xgqfrms  阅读(154)  评论(3编辑  收藏  举报