useCurrentInstance() 重命名为 useGlobalProperties()

This commit is contained in:
hooray 2022-10-23 14:23:43 +08:00
parent ebf0ceeb90
commit 21477cf630
4 changed files with 8 additions and 10 deletions

View File

@ -1,13 +1,13 @@
<script lang="ts" setup{{#if isGlobal}} name="{{ properCase name }}"{{/if}}> <script lang="ts" setup{{#if isGlobal}} name="{{ properCase name }}"{{/if}}>
// const proxy = useCurrentInstance() // 逻辑代码
</script> </script>
<template> <template>
<div> <div>
<!-- 内容区 --> <!-- 布局 -->
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
// scss // 样式
</style> </style>

View File

@ -1,15 +1,13 @@
<script lang="ts" setup name="{{ properCase componentName }}"> <script lang="ts" setup name="{{ properCase componentName }}">
// const proxy = useCurrentInstance() // 逻辑代码
// const router = useRouter()
// const route = useRoute()
</script> </script>
<template> <template>
<div> <div>
页面内容区域 <!-- 布局 -->
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
// scss // 样式
</style> </style>

View File

@ -60,7 +60,7 @@ declare global {
const useAuth: typeof import('./utils/composables/useAuth')['default'] const useAuth: typeof import('./utils/composables/useAuth')['default']
const useCssModule: typeof import('vue')['useCssModule'] const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars'] const useCssVars: typeof import('vue')['useCssVars']
const useCurrentInstance: typeof import('./utils/composables/useCurrentInstance')['default'] const useGlobalProperties: typeof import('./utils/composables/useGlobalProperties')['default']
const useMainPage: typeof import('./utils/composables/useMainPage')['default'] const useMainPage: typeof import('./utils/composables/useMainPage')['default']
const useMenu: typeof import('./utils/composables/useMenu')['default'] const useMenu: typeof import('./utils/composables/useMenu')['default']
const useRoute: typeof import('vue-router')['useRoute'] const useRoute: typeof import('vue-router')['useRoute']

View File

@ -1,6 +1,6 @@
import type { ComponentInternalInstance } from 'vue' import type { ComponentInternalInstance } from 'vue'
export default function useCurrentInstance() { export default function useGlobalProperties() {
const { appContext } = getCurrentInstance() as ComponentInternalInstance const { appContext } = getCurrentInstance() as ComponentInternalInstance
return appContext.config.globalProperties return appContext.config.globalProperties
} }