[Vue warn]: Property or method “window“ is not defined on the instance but referenced during render.

Don't hang your own things on the global

Type declaration:global.d.ts

import Vue from 'vue'

declare module 'vue/types/vue' {
  interface Vue {
    $message: any
  }
}

declare global {
  interface Window {
    $message: any
    Beidou: any
    uploadType:string
  }
}

Reason: Example this.

The variables found in the html tag are all called through the vue instance, that is, this., but the global window cannot be found.

Solution: assign to example/computed for reuse

global.d.ts | Chaoszhu's Blog

Guess you like

Origin blog.csdn.net/qq_28838891/article/details/132171492