当前位置:   article > 正文

vue3+vite+ts 组件中自动导入 ref 和 reactive_vite引入路由的ts如何自动补充后缀

vite引入路由的ts如何自动补充后缀
前言

在每个vue组件中,都去手动引入 ref 和 reactive 是非常繁琐的一件事,我们可以通过插件来完成自动导入

安装插件
npm i unplugin-auto-import -D
配置插件

在 vite.config.ts 中增加如下代码

  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import AutoImport from 'unplugin-auto-import/vite'
  4. import vueJsx from '@vitejs/plugin-vue-jsx'
  5. import path from 'path';
  6. import { fileURLToPath, URL } from "url";
  7. // 新npm install的包,这里导入如果报异常警告,就重启下IDE
  8. export default defineConfig({
  9. plugins: [vue(),vueJsx(),
  10. //增加下面这段代码,自动导入vue核心的包
  11. AutoImport({
  12. include: [
  13. /\.[tj]sx?$/,
  14. /\.vue$/,
  15. /\.vue\?vue/,
  16. /\.md$/,
  17. ],
  18. imports: ['vue','vue-router', 'pinia', '@vueuse/core'],
  19. //注意这个配置和src同级
  20. dts: './auto-imports.d.ts'
  21. })
  22. ],
  23. base: '/',
  24. resolve: {
  25. alias: {
  26. '@': path.resolve(__dirname, 'src'),
  27. },
  28. extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
  29. }
  30. })

配置完成后,运行 npm run dev 命令,会自动在项目根目录位置下生成 auto-imports.d.ts 这个文件,内容如下:

  1. /* eslint-disable */
  2. /* prettier-ignore */
  3. // @ts-nocheck
  4. // noinspection JSUnusedGlobalSymbols
  5. // Generated by unplugin-auto-import
  6. export {}
  7. declare global {
  8. const EffectScope: typeof import('vue')['EffectScope']
  9. const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
  10. const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
  11. const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
  12. const computed: typeof import('vue')['computed']
  13. const computedAsync: typeof import('@vueuse/core')['computedAsync']
  14. const computedEager: typeof import('@vueuse/core')['computedEager']
  15. const computedInject: typeof import('@vueuse/core')['computedInject']
  16. const computedWithControl: typeof import('@vueuse/core')['computedWithControl']
  17. const controlledComputed: typeof import('@vueuse/core')['controlledComputed']
  18. const controlledRef: typeof import('@vueuse/core')['controlledRef']
  19. const createApp: typeof import('vue')['createApp']
  20. const createEventHook: typeof import('@vueuse/core')['createEventHook']
  21. const createGlobalState: typeof import('@vueuse/core')['createGlobalState']
  22. const createInjectionState: typeof import('@vueuse/core')['createInjectionState']
  23. const createPinia: typeof import('pinia')['createPinia']
  24. const createReactiveFn: typeof import('@vueuse/core')['createReactiveFn']
  25. const createReusableTemplate: typeof import('@vueuse/core')['createReusableTemplate']
  26. const createSharedComposable: typeof import('@vueuse/core')['createSharedComposable']
  27. const createTemplatePromise: typeof import('@vueuse/core')['createTemplatePromise']
  28. const createUnrefFn: typeof import('@vueuse/core')['createUnrefFn']
  29. const customRef: typeof import('vue')['customRef']
  30. const debouncedRef: typeof import('@vueuse/core')['debouncedRef']
  31. const debouncedWatch: typeof import('@vueuse/core')['debouncedWatch']
  32. const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
  33. const defineComponent: typeof import('vue')['defineComponent']
  34. const defineStore: typeof import('pinia')['defineStore']
  35. const eagerComputed: typeof import('@vueuse/core')['eagerComputed']
  36. const effectScope: typeof import('vue')['effectScope']
  37. const extendRef: typeof import('@vueuse/core')['extendRef']
  38. const getActivePinia: typeof import('pinia')['getActivePinia']
  39. const getCurrentInstance: typeof import('vue')['getCurrentInstance']
  40. const getCurrentScope: typeof import('vue')['getCurrentScope']
  41. const h: typeof import('vue')['h']
  42. const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
  43. const inject: typeof import('vue')['inject']
  44. const injectLocal: typeof import('@vueuse/core')['injectLocal']
  45. const isDefined: typeof import('@vueuse/core')['isDefined']
  46. const isProxy: typeof import('vue')['isProxy']
  47. const isReactive: typeof import('vue')['isReactive']
  48. const isReadonly: typeof import('vue')['isReadonly']
  49. const isRef: typeof import('vue')['isRef']
  50. const makeDestructurable: typeof import('@vueuse/core')['makeDestructurable']
  51. const mapActions: typeof import('pinia')['mapActions']
  52. const mapGetters: typeof import('pinia')['mapGetters']
  53. const mapState: typeof import('pinia')['mapState']
  54. const mapStores: typeof import('pinia')['mapStores']
  55. const mapWritableState: typeof import('pinia')['mapWritableState']
  56. const markRaw: typeof import('vue')['markRaw']
  57. const nextTick: typeof import('vue')['nextTick']
  58. const onActivated: typeof import('vue')['onActivated']
  59. const onBeforeMount: typeof import('vue')['onBeforeMount']
  60. const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
  61. const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
  62. const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
  63. const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
  64. const onClickOutside: typeof import('@vueuse/core')['onClickOutside']
  65. const onDeactivated: typeof import('vue')['onDeactivated']
  66. const onErrorCaptured: typeof import('vue')['onErrorCaptured']
  67. const onKeyStroke: typeof import('@vueuse/core')['onKeyStroke']
  68. const onLongPress: typeof import('@vueuse/core')['onLongPress']
  69. const onMounted: typeof import('vue')['onMounted']
  70. const onRenderTracked: typeof import('vue')['onRenderTracked']
  71. const onRenderTriggered: typeof import('vue')['onRenderTriggered']
  72. const onScopeDispose: typeof import('vue')['onScopeDispose']
  73. const onServerPrefetch: typeof import('vue')['onServerPrefetch']
  74. const onStartTyping: typeof import('@vueuse/core')['onStartTyping']
  75. const onUnmounted: typeof import('vue')['onUnmounted']
  76. const onUpdated: typeof import('vue')['onUpdated']
  77. const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
  78. const provide: typeof import('vue')['provide']
  79. const provideLocal: typeof import('@vueuse/core')['provideLocal']
  80. const reactify: typeof import('@vueuse/core')['reactify']
  81. const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
  82. const reactive: typeof import('vue')['reactive']
  83. const reactiveComputed: typeof import('@vueuse/core')['reactiveComputed']
  84. const reactiveOmit: typeof import('@vueuse/core')['reactiveOmit']
  85. const reactivePick: typeof import('@vueuse/core')['reactivePick']
  86. const readonly: typeof import('vue')['readonly']
  87. const ref: typeof import('vue')['ref']
  88. const refAutoReset: typeof import('@vueuse/core')['refAutoReset']
  89. const refDebounced: typeof import('@vueuse/core')['refDebounced']
  90. const refDefault: typeof import('@vueuse/core')['refDefault']
  91. const refThrottled: typeof import('@vueuse/core')['refThrottled']
  92. const refWithControl: typeof import('@vueuse/core')['refWithControl']
  93. const resolveComponent: typeof import('vue')['resolveComponent']
  94. const resolveRef: typeof import('@vueuse/core')['resolveRef']
  95. const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
  96. const setActivePinia: typeof import('pinia')['setActivePinia']
  97. const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
  98. const shallowReactive: typeof import('vue')['shallowReactive']
  99. const shallowReadonly: typeof import('vue')['shallowReadonly']
  100. const shallowRef: typeof import('vue')['shallowRef']
  101. const storeToRefs: typeof import('pinia')['storeToRefs']
  102. const syncRef: typeof import('@vueuse/core')['syncRef']
  103. const syncRefs: typeof import('@vueuse/core')['syncRefs']
  104. const templateRef: typeof import('@vueuse/core')['templateRef']
  105. const throttledRef: typeof import('@vueuse/core')['throttledRef']
  106. const throttledWatch: typeof import('@vueuse/core')['throttledWatch']
  107. const toRaw: typeof import('vue')['toRaw']
  108. const toReactive: typeof import('@vueuse/core')['toReactive']
  109. const toRef: typeof import('vue')['toRef']
  110. const toRefs: typeof import('vue')['toRefs']
  111. const toValue: typeof import('vue')['toValue']
  112. const triggerRef: typeof import('vue')['triggerRef']
  113. const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
  114. const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']
  115. const tryOnMounted: typeof import('@vueuse/core')['tryOnMounted']
  116. const tryOnScopeDispose: typeof import('@vueuse/core')['tryOnScopeDispose']
  117. const tryOnUnmounted: typeof import('@vueuse/core')['tryOnUnmounted']
  118. const unref: typeof import('vue')['unref']
  119. const unrefElement: typeof import('@vueuse/core')['unrefElement']
  120. const until: typeof import('@vueuse/core')['until']
  121. const useActiveElement: typeof import('@vueuse/core')['useActiveElement']
  122. const useAnimate: typeof import('@vueuse/core')['useAnimate']
  123. const useArrayDifference: typeof import('@vueuse/core')['useArrayDifference']
  124. const useArrayEvery: typeof import('@vueuse/core')['useArrayEvery']
  125. const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter']
  126. const useArrayFind: typeof import('@vueuse/core')['useArrayFind']
  127. const useArrayFindIndex: typeof import('@vueuse/core')['useArrayFindIndex']
  128. const useArrayFindLast: typeof import('@vueuse/core')['useArrayFindLast']
  129. const useArrayIncludes: typeof import('@vueuse/core')['useArrayIncludes']
  130. const useArrayJoin: typeof import('@vueuse/core')['useArrayJoin']
  131. const useArrayMap: typeof import('@vueuse/core')['useArrayMap']
  132. const useArrayReduce: typeof import('@vueuse/core')['useArrayReduce']
  133. const useArraySome: typeof import('@vueuse/core')['useArraySome']
  134. const useArrayUnique: typeof import('@vueuse/core')['useArrayUnique']
  135. const useAsyncQueue: typeof import('@vueuse/core')['useAsyncQueue']
  136. const useAsyncState: typeof import('@vueuse/core')['useAsyncState']
  137. const useAttrs: typeof import('vue')['useAttrs']
  138. const useBase64: typeof import('@vueuse/core')['useBase64']
  139. const useBattery: typeof import('@vueuse/core')['useBattery']
  140. const useBluetooth: typeof import('@vueuse/core')['useBluetooth']
  141. const useBreakpoints: typeof import('@vueuse/core')['useBreakpoints']
  142. const useBroadcastChannel: typeof import('@vueuse/core')['useBroadcastChannel']
  143. const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
  144. const useCached: typeof import('@vueuse/core')['useCached']
  145. const useClipboard: typeof import('@vueuse/core')['useClipboard']
  146. const useCloned: typeof import('@vueuse/core')['useCloned']
  147. const useColorMode: typeof import('@vueuse/core')['useColorMode']
  148. const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
  149. const useCounter: typeof import('@vueuse/core')['useCounter']
  150. const useCssModule: typeof import('vue')['useCssModule']
  151. const useCssVar: typeof import('@vueuse/core')['useCssVar']
  152. const useCssVars: typeof import('vue')['useCssVars']
  153. const useCurrentElement: typeof import('@vueuse/core')['useCurrentElement']
  154. const useCycleList: typeof import('@vueuse/core')['useCycleList']
  155. const useDark: typeof import('@vueuse/core')['useDark']
  156. const useDateFormat: typeof import('@vueuse/core')['useDateFormat']
  157. const useDebounce: typeof import('@vueuse/core')['useDebounce']
  158. const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
  159. const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
  160. const useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']
  161. const useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']
  162. const useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']
  163. const useDevicesList: typeof import('@vueuse/core')['useDevicesList']
  164. const useDisplayMedia: typeof import('@vueuse/core')['useDisplayMedia']
  165. const useDocumentVisibility: typeof import('@vueuse/core')['useDocumentVisibility']
  166. const useDraggable: typeof import('@vueuse/core')['useDraggable']
  167. const useDropZone: typeof import('@vueuse/core')['useDropZone']
  168. const useElementBounding: typeof import('@vueuse/core')['useElementBounding']
  169. const useElementByPoint: typeof import('@vueuse/core')['useElementByPoint']
  170. const useElementHover: typeof import('@vueuse/core')['useElementHover']
  171. const useElementSize: typeof import('@vueuse/core')['useElementSize']
  172. const useElementVisibility: typeof import('@vueuse/core')['useElementVisibility']
  173. const useEventBus: typeof import('@vueuse/core')['useEventBus']
  174. const useEventListener: typeof import('@vueuse/core')['useEventListener']
  175. const useEventSource: typeof import('@vueuse/core')['useEventSource']
  176. const useEyeDropper: typeof import('@vueuse/core')['useEyeDropper']
  177. const useFavicon: typeof import('@vueuse/core')['useFavicon']
  178. const useFetch: typeof import('@vueuse/core')['useFetch']
  179. const useFileDialog: typeof import('@vueuse/core')['useFileDialog']
  180. const useFileSystemAccess: typeof import('@vueuse/core')['useFileSystemAccess']
  181. const useFocus: typeof import('@vueuse/core')['useFocus']
  182. const useFocusWithin: typeof import('@vueuse/core')['useFocusWithin']
  183. const useFps: typeof import('@vueuse/core')['useFps']
  184. const useFullscreen: typeof import('@vueuse/core')['useFullscreen']
  185. const useGamepad: typeof import('@vueuse/core')['useGamepad']
  186. const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
  187. const useIdle: typeof import('@vueuse/core')['useIdle']
  188. const useImage: typeof import('@vueuse/core')['useImage']
  189. const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
  190. const useIntersectionObserver: typeof import('@vueuse/core')['useIntersectionObserver']
  191. const useInterval: typeof import('@vueuse/core')['useInterval']
  192. const useIntervalFn: typeof import('@vueuse/core')['useIntervalFn']
  193. const useKeyModifier: typeof import('@vueuse/core')['useKeyModifier']
  194. const useLastChanged: typeof import('@vueuse/core')['useLastChanged']
  195. const useLink: typeof import('vue-router')['useLink']
  196. const useLocalStorage: typeof import('@vueuse/core')['useLocalStorage']
  197. const useMagicKeys: typeof import('@vueuse/core')['useMagicKeys']
  198. const useManualRefHistory: typeof import('@vueuse/core')['useManualRefHistory']
  199. const useMediaControls: typeof import('@vueuse/core')['useMediaControls']
  200. const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
  201. const useMemoize: typeof import('@vueuse/core')['useMemoize']
  202. const useMemory: typeof import('@vueuse/core')['useMemory']
  203. const useMounted: typeof import('@vueuse/core')['useMounted']
  204. const useMouse: typeof import('@vueuse/core')['useMouse']
  205. const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
  206. const useMousePressed: typeof import('@vueuse/core')['useMousePressed']
  207. const useMutationObserver: typeof import('@vueuse/core')['useMutationObserver']
  208. const useNavigatorLanguage: typeof import('@vueuse/core')['useNavigatorLanguage']
  209. const useNetwork: typeof import('@vueuse/core')['useNetwork']
  210. const useNow: typeof import('@vueuse/core')['useNow']
  211. const useObjectUrl: typeof import('@vueuse/core')['useObjectUrl']
  212. const useOffsetPagination: typeof import('@vueuse/core')['useOffsetPagination']
  213. const useOnline: typeof import('@vueuse/core')['useOnline']
  214. const usePageLeave: typeof import('@vueuse/core')['usePageLeave']
  215. const useParallax: typeof import('@vueuse/core')['useParallax']
  216. const useParentElement: typeof import('@vueuse/core')['useParentElement']
  217. const usePerformanceObserver: typeof import('@vueuse/core')['usePerformanceObserver']
  218. const usePermission: typeof import('@vueuse/core')['usePermission']
  219. const usePointer: typeof import('@vueuse/core')['usePointer']
  220. const usePointerLock: typeof import('@vueuse/core')['usePointerLock']
  221. const usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']
  222. const usePreferredColorScheme: typeof import('@vueuse/core')['usePreferredColorScheme']
  223. const usePreferredContrast: typeof import('@vueuse/core')['usePreferredContrast']
  224. const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']
  225. const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']
  226. const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion']
  227. const usePrevious: typeof import('@vueuse/core')['usePrevious']
  228. const useRafFn: typeof import('@vueuse/core')['useRafFn']
  229. const useRefHistory: typeof import('@vueuse/core')['useRefHistory']
  230. const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']
  231. const useRoute: typeof import('vue-router')['useRoute']
  232. const useRouter: typeof import('vue-router')['useRouter']
  233. const useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation']
  234. const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea']
  235. const useScriptTag: typeof import('@vueuse/core')['useScriptTag']
  236. const useScroll: typeof import('@vueuse/core')['useScroll']
  237. const useScrollLock: typeof import('@vueuse/core')['useScrollLock']
  238. const useSessionStorage: typeof import('@vueuse/core')['useSessionStorage']
  239. const useShare: typeof import('@vueuse/core')['useShare']
  240. const useSlots: typeof import('vue')['useSlots']
  241. const useSorted: typeof import('@vueuse/core')['useSorted']
  242. const useSpeechRecognition: typeof import('@vueuse/core')['useSpeechRecognition']
  243. const useSpeechSynthesis: typeof import('@vueuse/core')['useSpeechSynthesis']
  244. const useStepper: typeof import('@vueuse/core')['useStepper']
  245. const useStorage: typeof import('@vueuse/core')['useStorage']
  246. const useStorageAsync: typeof import('@vueuse/core')['useStorageAsync']
  247. const useStyleTag: typeof import('@vueuse/core')['useStyleTag']
  248. const useSupported: typeof import('@vueuse/core')['useSupported']
  249. const useSwipe: typeof import('@vueuse/core')['useSwipe']
  250. const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
  251. const useTextDirection: typeof import('@vueuse/core')['useTextDirection']
  252. const useTextSelection: typeof import('@vueuse/core')['useTextSelection']
  253. const useTextareaAutosize: typeof import('@vueuse/core')['useTextareaAutosize']
  254. const useThrottle: typeof import('@vueuse/core')['useThrottle']
  255. const useThrottleFn: typeof import('@vueuse/core')['useThrottleFn']
  256. const useThrottledRefHistory: typeof import('@vueuse/core')['useThrottledRefHistory']
  257. const useTimeAgo: typeof import('@vueuse/core')['useTimeAgo']
  258. const useTimeout: typeof import('@vueuse/core')['useTimeout']
  259. const useTimeoutFn: typeof import('@vueuse/core')['useTimeoutFn']
  260. const useTimeoutPoll: typeof import('@vueuse/core')['useTimeoutPoll']
  261. const useTimestamp: typeof import('@vueuse/core')['useTimestamp']
  262. const useTitle: typeof import('@vueuse/core')['useTitle']
  263. const useToNumber: typeof import('@vueuse/core')['useToNumber']
  264. const useToString: typeof import('@vueuse/core')['useToString']
  265. const useToggle: typeof import('@vueuse/core')['useToggle']
  266. const useTransition: typeof import('@vueuse/core')['useTransition']
  267. const useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams']
  268. const useUserMedia: typeof import('@vueuse/core')['useUserMedia']
  269. const useVModel: typeof import('@vueuse/core')['useVModel']
  270. const useVModels: typeof import('@vueuse/core')['useVModels']
  271. const useVibrate: typeof import('@vueuse/core')['useVibrate']
  272. const useVirtualList: typeof import('@vueuse/core')['useVirtualList']
  273. const useWakeLock: typeof import('@vueuse/core')['useWakeLock']
  274. const useWebNotification: typeof import('@vueuse/core')['useWebNotification']
  275. const useWebSocket: typeof import('@vueuse/core')['useWebSocket']
  276. const useWebWorker: typeof import('@vueuse/core')['useWebWorker']
  277. const useWebWorkerFn: typeof import('@vueuse/core')['useWebWorkerFn']
  278. const useWindowFocus: typeof import('@vueuse/core')['useWindowFocus']
  279. const useWindowScroll: typeof import('@vueuse/core')['useWindowScroll']
  280. const useWindowSize: typeof import('@vueuse/core')['useWindowSize']
  281. const watch: typeof import('vue')['watch']
  282. const watchArray: typeof import('@vueuse/core')['watchArray']
  283. const watchAtMost: typeof import('@vueuse/core')['watchAtMost']
  284. const watchDebounced: typeof import('@vueuse/core')['watchDebounced']
  285. const watchDeep: typeof import('@vueuse/core')['watchDeep']
  286. const watchEffect: typeof import('vue')['watchEffect']
  287. const watchIgnorable: typeof import('@vueuse/core')['watchIgnorable']
  288. const watchImmediate: typeof import('@vueuse/core')['watchImmediate']
  289. const watchOnce: typeof import('@vueuse/core')['watchOnce']
  290. const watchPausable: typeof import('@vueuse/core')['watchPausable']
  291. const watchPostEffect: typeof import('vue')['watchPostEffect']
  292. const watchSyncEffect: typeof import('vue')['watchSyncEffect']
  293. const watchThrottled: typeof import('@vueuse/core')['watchThrottled']
  294. const watchTriggerable: typeof import('@vueuse/core')['watchTriggerable']
  295. const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
  296. const whenever: typeof import('@vueuse/core')['whenever']
  297. }
  298. // for type re-export
  299. declare global {
  300. // @ts-ignore
  301. export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
  302. }

最后我们配置下 tsconfig.json 即可

  1. "include": [
  2. "src/**/*.ts",
  3. "src/**/*.d.ts",
  4. "src/**/*.tsx",
  5. "src/**/*.vue",
  6. "./*.d.ts",
  7. "./auto-imports.d.ts",
  8. "node_modules/unplugin-auto-import/auto-imports.d.ts",
  9. ]

效果检验

我们 import 包的时候,并没有导入 ref 和 onMounted 函数,但 IDE 也是正常的不会报错

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/213618
推荐阅读
相关标签
  

闽ICP备14008679号