Search code examples
typescriptvue.jsnuxt.jsvue-property-decorator

NuxtJS : problem import ing Component in mixin


my stacks are Nuxtjs and Nuxt-property-decorator

I've made a mixin to avoid repeating a method

that method need a component ( Alert component )

so , I imported that component in mixin

But i have error for importing component

Note : i am sure import address is true

mixin/logOut.ts import Vue from 'vue'

import { Component } from 'nuxt-property-decorator'
import AppAlert from '~/components/Common/AppAlert'
@Component
export class LogOut extends Vue {
  async LogOut() {
    const confirm = await this.$dialog.show({
      component: AppAlert,
      props: {
        title: { text: 'Exit ?', icon: 'exclamation-thick' },
        body: 'Exit Connector ?',
        btn: { text: 'Confirm', icon: 'power', color: 'error' }
      }
    })
    
    if (confirm) {
      this.$auth.logout()
    }
  }
}

enter image description here

error text is :

Cannot find module '~/components/Common/AppAlert' or its corresponding type declarations.ts(2307)

Solution

  • I found answer from this link.

    I added

    vue-shims.d.ts

    declare module "*.vue" {
      import Vue from 'vue'
      export default Vue
    }