(共556篇)
全部分类

vue3 如何给自定义全局属性添加TS支持
[ Vue(2+3) ] 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { createApp } from "vue";
import App from "./App.vue";

declare module "@vue/runtime-core" {
  interface ComponentCustomProperties {
    $statusBarHeight: string;
    $navbarHeight: string;
  }
}

const app = createApp();
app.config.globalProperty.$statusBarHeight = 0;
app.config.globalProperty.$navbarHeight = 0;