
- //由于vue3没有Prototype使用 app.config.globalProperties代替 然后定义变量和函数
- //vue2方式 Vue.prototype.$http = $http
- //vue3方式 app.config.globalProperties.$http = $http
- type Filter = {
- format: <T>(str: T) => string
- }
-
- declare module '@vue/runtime-core' {
- export interface ComponentCustomProperties {
- $filters: Filter,
- $env: string
- }
- }
-
- app.config.globalProperties.$filters = {
- format <T>(str:T):string {
- return `真.${str}`
- }
- }
- app.config.globalProperties.$env = 'dev'
