Vue2 在 vue3 中扩展替代方案

问题描述 投票:0回答:1
import Vue from "vue";
const rootVeComp = Vue.extend(VueGlobalCart);
this.vueMiniCart = new rootVueComp({
                      el: this.selector,
                      Data: {
                            jsonUrl: this.props.json,
                            cartAriaText: this.props.cartAriaText
                            }
                    });

我尝试过createApp和defineComponent,但它不起作用。

vue.js vuejs2 vuejs3
1个回答
0
投票

您可以简单地使用扩展:

const comp = {
    extends: ParentComponent,
    data() {
        return {
            ...
        }
    },
    mounted() {

    },
};
© www.soinside.com 2019 - 2024. All rights reserved.