в migration build, избавляюсь от предупреждений в консоли. Не могу понять как переписать создание дополнительного инстанса внутри основного.
                  
                  
                  
                  
                  
                  Старый код, который работал под Vue 2:
                  
                  
                  
                  
                  
                  import ChildComponent from './ChildComponent'
                  
                  
                  const Constructor = Vue.extend(ChildComponent)
                  
                  
                  ;(childApp = new Constructor({
                  
                  
                    router: this.$router,
                  
                  
                    store: this.$store
                  
                  
                  })).$mount()
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  Вариант для Vue 3, который успешно рендерит дочерний инстанс с компонентом, но выдаёт warnings:
                  
                  
                  
                  
                  
                  import ChildComponent from './ChildComponent'
                  
                  
                  childApp = createApp(ChildComponent)
                  
                  
                  childApp.use(this.$router)
                  
                  
                  childApp.use(this.$store)
                  
                  
                  childApp.mount('#child-container')
                  
                  
                  
                  
                  
                  [Vue warn]: Component "RouterLink" has already been registered in target app.
                  
                  
                  [Vue warn]: Component "RouterView" has already been registered in target app.
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  Вариант для Vue 3, который не рендерит, а выдаёт ошибку:
                  
                  
                  
                  
                  
                  import ChildComponent from './ChildComponent'
                  
                  
                  childApp = createApp({
                  
                  
                      router: this.$router,
                  
                  
                      store: this.$store,
                  
                  
                      render: () => h(ChildComponent),
                  
                  
                  })
                  
                  
                  childApp.mount('#child-container')
                  
                  
                  
                  
                  
                  Uncaught TypeError: Cannot read properties of undefined (reading '_modulesNamespaceMap')
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  Как сделать чтобы работало без предупреждений?
                  
                  
                
const _this = this;
У меня вроде нигде нет функций, в которых контекст может быть не тот. Поясните, пожалуйста)
Обсуждают сегодня