W
W
WAYNEDEV2022-04-12 15:34:28
Vue.js
WAYNEDEV, 2022-04-12 15:34:28

Refactoring new Vue() in vue 3?

Hello!
We decided to migrate from vue-2 to vue-3, but found this thing in a large component that is often used:

import table from './table.js'

export default {
       data() { return {table: null}}, 
       beforeCreate() {
            this.table = new Vue(table);
        },
        provide() {
            return {
                table: this.table
            };
        },
}


table.js itself is set up like a regular mixin, but to touch its methods or state, you need to write this.table.

Everything would be fine, but in Vue 3 there is no new Vue construct anymore, and I don’t know how to redo it without breaking the entire component. Maybe there is a similar and compatible approach?

I would be very grateful for your help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Khokhlov, 2022-04-12
@andrhohlov

Try the documentation:
https://v3-migration.vuejs.org/breaking-changes/gl...
https://vuejs.org/api/application.html#createapp
(and I would reconsider the approach with creating a new application inside the component )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question