TypeScript 支援
Vue
不需要任何設定即可使用. 但如果你想要自己定義設定 選項(options), 你可以像這樣處理:
main.ts
import Vue from 'vue'
import VueFinalModal, { VfmOptions, VueFinalModalProperty } from 'vue-final-modal'
Vue.use<VfmOptions>(VueFinalModal(), {
componentName: 'VModal',
key: '$modal'
})
// define the setup options
declare module 'vue/types/vue' {
interface Vue {
$modal: VueFinalModalProperty
}
}
Nuxt
在 tsconfig.json 設定中的 types 陣列中加上這個型別。
tsconfig.json
{
"compilerOptions": {
"types": [
// other types
// ...
"vue-final-modal"
]
}
}