- app.component
- app.config
- app.directive
- app.mount
- app.unmount
- app.use
main.ts
import {createApp} from 'vue'
import App from'./App.vue'
import Hello from'./Hello.vue'
// 创建应用
const app = createApp(App)
//全局组件
app.component('Hello',Hello)
//全局属性
app.config.globalProperties.x=99
declare module 'vue' {
interface ComponentcustomProperties {
x:number
}
}
//全局指令
app.directive('beauty',(element,{value})=>{
element.innerText += value
element.style.color='green'
element.style.backgroundcolor ='yellow'
})