引入 unplugin-auto-import 依赖,修改框架部分代码

This commit is contained in:
hooray 2021-09-09 16:40:22 +08:00
parent 97122d1467
commit 9dc788d324
35 changed files with 137 additions and 75 deletions

View File

@ -14,7 +14,8 @@ module.exports = {
extends: [ extends: [
'plugin:vue/vue3-recommended', 'plugin:vue/vue3-recommended',
'plugin:vue/vue3-strongly-recommended', 'plugin:vue/vue3-strongly-recommended',
'eslint:recommended' 'eslint:recommended',
'./auto-import-eslint-config.js'
], ],
parser: 'vue-eslint-parser', parser: 'vue-eslint-parser',
rules: { rules: {

3
.gitignore vendored
View File

@ -3,4 +3,5 @@ node_modules
dist* dist*
dist-ssr dist-ssr
*.local *.local
src/assets/sprites/*.* src/assets/sprites/*.*
auto-imports.d.ts

View File

@ -0,0 +1,53 @@
module.exports = {
globals: {
// lifecycle
onActivated: 'readonly',
onBeforeMount: 'readonly',
onBeforeUnmount: 'readonly',
onBeforeUpdate: 'readonly',
onDeactivated: 'readonly',
onErrorCaptured: 'readonly',
onMounted: 'readonly',
onServerPrefetch: 'readonly',
onUnmounted: 'readonly',
onUpdated: 'readonly',
// reactivity
computed: 'readonly',
customRef: 'readonly',
isReadonly: 'readonly',
isRef: 'readonly',
markRaw: 'readonly',
reactive: 'readonly',
readonly: 'readonly',
ref: 'readonly',
shallowReactive: 'readonly',
shallowReadonly: 'readonly',
shallowRef: 'readonly',
toRaw: 'readonly',
toRef: 'readonly',
toRefs: 'readonly',
triggerRef: 'readonly',
unref: 'readonly',
watch: 'readonly',
watchEffect: 'readonly',
// component
defineComponent: 'readonly',
defineAsyncComponent: 'readonly',
getCurrentInstance: 'readonly',
h: 'readonly',
inject: 'readonly',
nextTick: 'readonly',
provide: 'readonly',
useCssModule: 'readonly',
// other
defineProps: 'readonly',
defineEmits: 'readonly',
defineExpose: 'readonly',
withDefaults: 'readonly',
// vue-router
useRoute: 'readonly',
useRouter: 'readonly',
// vuex
useStore: 'readonly'
}
}

View File

@ -48,6 +48,7 @@
"stylelint-config-standard": "^22.0.0", "stylelint-config-standard": "^22.0.0",
"stylelint-scss": "^3.20.1", "stylelint-scss": "^3.20.1",
"svgo": "^2.5.0", "svgo": "^2.5.0",
"unplugin-auto-import": "^0.4.5",
"unplugin-vue-components": "^0.14.11", "unplugin-vue-components": "^0.14.11",
"vite": "^2.5.3", "vite": "^2.5.3",
"vite-plugin-banner": "^0.1.3", "vite-plugin-banner": "^0.1.3",

View File

@ -28,6 +28,7 @@ specifiers:
stylelint-scss: ^3.20.1 stylelint-scss: ^3.20.1
svgo: ^2.5.0 svgo: ^2.5.0
tinymce: ^5.9.1 tinymce: ^5.9.1
unplugin-auto-import: ^0.4.5
unplugin-vue-components: ^0.14.11 unplugin-vue-components: ^0.14.11
vite: ^2.5.3 vite: ^2.5.3
vite-plugin-banner: ^0.1.3 vite-plugin-banner: ^0.1.3
@ -75,6 +76,7 @@ devDependencies:
stylelint-config-standard: registry.nlark.com/stylelint-config-standard/22.0.0_stylelint@13.13.1 stylelint-config-standard: registry.nlark.com/stylelint-config-standard/22.0.0_stylelint@13.13.1
stylelint-scss: registry.nlark.com/stylelint-scss/3.20.1_stylelint@13.13.1 stylelint-scss: registry.nlark.com/stylelint-scss/3.20.1_stylelint@13.13.1
svgo: registry.nlark.com/svgo/2.5.0 svgo: registry.nlark.com/svgo/2.5.0
unplugin-auto-import: registry.nlark.com/unplugin-auto-import/0.4.5_vite@2.5.3
unplugin-vue-components: registry.nlark.com/unplugin-vue-components/0.14.11_vite@2.5.3+vue@3.2.8 unplugin-vue-components: registry.nlark.com/unplugin-vue-components/0.14.11_vite@2.5.3+vue@3.2.8
vite: registry.nlark.com/vite/2.5.3 vite: registry.nlark.com/vite/2.5.3
vite-plugin-banner: registry.nlark.com/vite-plugin-banner/0.1.3 vite-plugin-banner: registry.nlark.com/vite-plugin-banner/0.1.3
@ -2546,7 +2548,7 @@ packages:
dev: true dev: true
/resolve/1.20.0: /resolve/1.20.0:
resolution: {integrity: sha1-YpoBP7P3B1XW8LeTXMHCxTeLGXU=, tarball: resolve/download/resolve-1.20.0.tgz?cache=0&sync_timestamp=1613098300584&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.20.0.tgz} resolution: {integrity: sha1-YpoBP7P3B1XW8LeTXMHCxTeLGXU=, tarball: resolve/download/resolve-1.20.0.tgz}
dependencies: dependencies:
is-core-module: registry.nlark.com/is-core-module/2.6.0 is-core-module: registry.nlark.com/is-core-module/2.6.0
path-parse: registry.nlark.com/path-parse/1.0.7 path-parse: registry.nlark.com/path-parse/1.0.7
@ -3068,11 +3070,6 @@ packages:
isobject: 3.0.1 isobject: 3.0.1
dev: true dev: true
/upath/2.0.1:
resolution: {integrity: sha1-UMc96mjW9rmQ9R0nnOYIFmXWGos=, tarball: upath/download/upath-2.0.1.tgz}
engines: {node: '>=4'}
dev: true
/upper-case-first/1.1.2: /upper-case-first/1.1.2:
resolution: {integrity: sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU=, tarball: upper-case-first/download/upper-case-first-1.1.2.tgz} resolution: {integrity: sha1-XXm+3P8UQZUY/S7bCgUHybaFkRU=, tarball: upper-case-first/download/upper-case-first-1.1.2.tgz}
dependencies: dependencies:
@ -3233,6 +3230,14 @@ packages:
resolution: {integrity: sha1-0R1zgf/tFrdC9q97PyI9XNn+mSA=, tarball: zwitch/download/zwitch-1.0.5.tgz} resolution: {integrity: sha1-0R1zgf/tFrdC9q97PyI9XNn+mSA=, tarball: zwitch/download/zwitch-1.0.5.tgz}
dev: true dev: true
registry.nlark.com/@antfu/utils/0.3.0:
resolution: {integrity: sha1-YwbEO1Kog72Olz4+2N1kJIQYvMQ=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@antfu/utils/download/@antfu/utils-0.3.0.tgz}
name: '@antfu/utils'
version: 0.3.0
dependencies:
'@types/throttle-debounce': registry.nlark.com/@types/throttle-debounce/2.1.0
dev: true
registry.nlark.com/@babel/code-frame/7.12.11: registry.nlark.com/@babel/code-frame/7.12.11:
resolution: {integrity: sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@babel/code-frame/download/@babel/code-frame-7.12.11.tgz} resolution: {integrity: sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@babel/code-frame/download/@babel/code-frame-7.12.11.tgz}
name: '@babel/code-frame' name: '@babel/code-frame'
@ -3756,6 +3761,12 @@ packages:
'@types/node': registry.nlark.com/@types/node/16.7.10 '@types/node': registry.nlark.com/@types/node/16.7.10
dev: true dev: true
registry.nlark.com/@types/throttle-debounce/2.1.0:
resolution: {integrity: sha1-HD32JL/Eti+ZLTASuExW1B6rN3Y=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@types/throttle-debounce/download/@types/throttle-debounce-2.1.0.tgz}
name: '@types/throttle-debounce'
version: 2.1.0
dev: true
registry.nlark.com/@types/through/0.0.30: registry.nlark.com/@types/through/0.0.30:
resolution: {integrity: sha1-4OQs536Je9aurW9upirrE1uKOJU=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@types/through/download/@types/through-0.0.30.tgz?cache=0&sync_timestamp=1629710122580&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fthrough%2Fdownload%2F%40types%2Fthrough-0.0.30.tgz} resolution: {integrity: sha1-4OQs536Je9aurW9upirrE1uKOJU=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/@types/through/download/@types/through-0.0.30.tgz?cache=0&sync_timestamp=1629710122580&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Fthrough%2Fdownload%2F%40types%2Fthrough-0.0.30.tgz}
name: '@types/through' name: '@types/through'
@ -4712,6 +4723,12 @@ packages:
dev: true dev: true
optional: true optional: true
registry.nlark.com/function-bind/1.1.1:
resolution: {integrity: sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/function-bind/download/function-bind-1.1.1.tgz}
name: function-bind
version: 1.1.1
dev: true
registry.nlark.com/get-pixels/3.3.3: registry.nlark.com/get-pixels/3.3.3:
resolution: {integrity: sha1-ceLf1L77gQtUeKYcY1SACXbOAcc=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/get-pixels/download/get-pixels-3.3.3.tgz} resolution: {integrity: sha1-ceLf1L77gQtUeKYcY1SACXbOAcc=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/get-pixels/download/get-pixels-3.3.3.tgz}
name: get-pixels name: get-pixels
@ -4865,6 +4882,15 @@ packages:
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dev: true dev: true
registry.nlark.com/has/1.0.3:
resolution: {integrity: sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/has/download/has-1.0.3.tgz}
name: has
version: 1.0.3
engines: {node: '>= 0.4.0'}
dependencies:
function-bind: registry.nlark.com/function-bind/1.1.1
dev: true
registry.nlark.com/he/1.2.0: registry.nlark.com/he/1.2.0:
resolution: {integrity: sha1-hK5l+n6vsWX922FWauFLrwVmTw8=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/he/download/he-1.2.0.tgz} resolution: {integrity: sha1-hK5l+n6vsWX922FWauFLrwVmTw8=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/he/download/he-1.2.0.tgz}
name: he name: he
@ -4999,11 +5025,11 @@ packages:
dev: true dev: true
registry.nlark.com/is-core-module/2.6.0: registry.nlark.com/is-core-module/2.6.0:
resolution: {integrity: sha1-11U7JSb+Wbkro+QMjfdX7Ipwnhk=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/is-core-module/download/is-core-module-2.6.0.tgz} resolution: {integrity: sha1-11U7JSb+Wbkro+QMjfdX7Ipwnhk=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/is-core-module/download/is-core-module-2.6.0.tgz?cache=0&sync_timestamp=1629224905008&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-core-module%2Fdownload%2Fis-core-module-2.6.0.tgz}
name: is-core-module name: is-core-module
version: 2.6.0 version: 2.6.0
dependencies: dependencies:
has: 1.0.3 has: registry.nlark.com/has/1.0.3
dev: true dev: true
registry.nlark.com/is-data-descriptor/0.1.4: registry.nlark.com/is-data-descriptor/0.1.4:
@ -5435,7 +5461,7 @@ packages:
dev: true dev: true
registry.nlark.com/picomatch/2.3.0: registry.nlark.com/picomatch/2.3.0:
resolution: {integrity: sha1-8fBh3o9qS/AiiS4tEoI0+5gwKXI=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/picomatch/download/picomatch-2.3.0.tgz} resolution: {integrity: sha1-8fBh3o9qS/AiiS4tEoI0+5gwKXI=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/picomatch/download/picomatch-2.3.0.tgz?cache=0&sync_timestamp=1621648246651&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fpicomatch%2Fdownload%2Fpicomatch-2.3.0.tgz}
name: picomatch name: picomatch
version: 2.3.0 version: 2.3.0
engines: {node: '>=8.6'} engines: {node: '>=8.6'}
@ -6202,6 +6228,27 @@ packages:
version: 4.1.0 version: 4.1.0
dev: true dev: true
registry.nlark.com/unplugin-auto-import/0.4.5_vite@2.5.3:
resolution: {integrity: sha1-JVpSgT8+955Xdb5jD5X2Znz0qFA=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/unplugin-auto-import/download/unplugin-auto-import-0.4.5.tgz}
id: registry.nlark.com/unplugin-auto-import/0.4.5
name: unplugin-auto-import
version: 0.4.5
engines: {node: '>=14'}
peerDependencies:
'@vueuse/core': ^6.0.0
dependencies:
'@antfu/utils': registry.nlark.com/@antfu/utils/0.3.0
'@rollup/pluginutils': registry.nlark.com/@rollup/pluginutils/4.1.1
has-pkg: registry.nlark.com/has-pkg/0.0.1
magic-string: 0.25.7
resolve: 1.20.0
unplugin: registry.nlark.com/unplugin/0.2.7_vite@2.5.3
transitivePeerDependencies:
- rollup
- vite
- webpack
dev: true
registry.nlark.com/unplugin-vue-components/0.14.11_vite@2.5.3+vue@3.2.8: registry.nlark.com/unplugin-vue-components/0.14.11_vite@2.5.3+vue@3.2.8:
resolution: {integrity: sha1-rvLASAMW6GRFDLPgt/Y+jxBpUCc=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/unplugin-vue-components/download/unplugin-vue-components-0.14.11.tgz} resolution: {integrity: sha1-rvLASAMW6GRFDLPgt/Y+jxBpUCc=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/unplugin-vue-components/download/unplugin-vue-components-0.14.11.tgz}
id: registry.nlark.com/unplugin-vue-components/0.14.11 id: registry.nlark.com/unplugin-vue-components/0.14.11
@ -6235,19 +6282,19 @@ packages:
rollup: ^2.50.0 rollup: ^2.50.0
vite: ^2.3.0 vite: ^2.3.0
webpack: ^4.0.0 webpack: ^4.0.0
peerDependenciesMeta:
rollup:
optional: true
vite:
optional: true
webpack:
optional: true
dependencies: dependencies:
upath: 2.0.1 upath: registry.nlark.com/upath/2.0.1
vite: registry.nlark.com/vite/2.5.3 vite: registry.nlark.com/vite/2.5.3
webpack-virtual-modules: registry.nlark.com/webpack-virtual-modules/0.4.3 webpack-virtual-modules: registry.nlark.com/webpack-virtual-modules/0.4.3
dev: true dev: true
registry.nlark.com/upath/2.0.1:
resolution: {integrity: sha1-UMc96mjW9rmQ9R0nnOYIFmXWGos=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/upath/download/upath-2.0.1.tgz}
name: upath
version: 2.0.1
engines: {node: '>=4'}
dev: true
registry.nlark.com/uuid/3.4.0: registry.nlark.com/uuid/3.4.0:
resolution: {integrity: sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1622213308116&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz} resolution: {integrity: sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=, registry: https://registry.npm.taobao.org/, tarball: https://registry.nlark.com/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1622213308116&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz}
name: uuid name: uuid

View File

@ -3,9 +3,6 @@
</template> </template>
<script setup> <script setup>
import { watch, onMounted } from 'vue'
import { useStore } from 'vuex'
const store = useStore() const store = useStore()
watch(() => store.state.settings.mode, () => { watch(() => store.state.settings.mode, () => {

View File

@ -7,7 +7,6 @@
<script setup> <script setup>
import { auth } from '@/util' import { auth } from '@/util'
import { defineProps } from 'vue'
const props = defineProps({ const props = defineProps({
value: { value: {

View File

@ -7,7 +7,6 @@
<script setup> <script setup>
import { authAll } from '@/util' import { authAll } from '@/util'
import { defineProps } from 'vue'
const props = defineProps({ const props = defineProps({
value: { value: {

View File

@ -9,8 +9,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, defineEmits, computed } from 'vue'
const props = defineProps({ const props = defineProps({
data: { data: {
type: Array, type: Array,

View File

@ -6,7 +6,6 @@
<script setup> <script setup>
import area from '@/util/area' import area from '@/util/area'
import { defineProps, defineEmits, ref, computed } from 'vue'
const props = defineProps({ const props = defineProps({
// ['', '', ''] // ['', '', '']

View File

@ -28,8 +28,6 @@ import 'tinymce/plugins/wordcount'
import 'tinymce/plugins/code' import 'tinymce/plugins/code'
import 'tinymce/plugins/searchreplace' import 'tinymce/plugins/searchreplace'
import { defineProps, defineEmits, ref, computed, watch, onMounted } from 'vue'
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
type: String, type: String,

View File

@ -25,8 +25,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, defineEmits, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({

View File

@ -5,8 +5,6 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from 'vue'
const data = ref({ const data = ref({
isBottom: true isBottom: true
}) })

View File

@ -9,8 +9,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, computed } from 'vue'
const props = defineProps({ const props = defineProps({
src: { src: {
type: String, type: String,

View File

@ -46,8 +46,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, defineEmits, ref, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({

View File

@ -50,8 +50,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, defineEmits, ref, getCurrentInstance } from 'vue'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({

View File

@ -13,8 +13,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps } from 'vue'
defineProps({ defineProps({
title: { title: {
type: String, type: String,

View File

@ -15,8 +15,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, ref } from 'vue'
const props = defineProps({ const props = defineProps({
title: { title: {
type: String, type: String,

View File

@ -21,8 +21,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps } from 'vue'
defineProps({ defineProps({
type: { type: {
type: String, type: String,

View File

@ -8,8 +8,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, defineEmits, ref, watch } from 'vue'
const props = defineProps({ const props = defineProps({
showMore: { showMore: {
type: Boolean, type: Boolean,

View File

@ -6,8 +6,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, computed } from 'vue'
const props = defineProps({ const props = defineProps({
name: { name: {
type: String, type: String,

View File

@ -8,8 +8,6 @@
</template> </template>
<script setup> <script setup>
import { defineProps, computed } from 'vue'
const props = defineProps({ const props = defineProps({
value: { value: {
type: String, type: String,

View File

@ -24,8 +24,6 @@
</template> </template>
<script setup> <script setup>
import { getCurrentInstance, onMounted, ref } from 'vue'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const locationOrigin = ref(location.href) const locationOrigin = ref(location.href)

View File

@ -23,7 +23,6 @@
<script setup> <script setup>
import Logo from '../Logo/index.vue' import Logo from '../Logo/index.vue'
import UserMenu from '../UserMenu/index.vue' import UserMenu from '../UserMenu/index.vue'
import { inject } from 'vue'
const switchMenu = inject('switchMenu') const switchMenu = inject('switchMenu')
</script> </script>

View File

@ -7,8 +7,6 @@
<script setup> <script setup>
import imgLogo from '@/assets/images/logo.png' import imgLogo from '@/assets/images/logo.png'
import { defineProps, ref, computed } from 'vue'
import { useStore } from 'vuex'
const store = useStore() const store = useStore()

View File

@ -21,7 +21,6 @@
<script setup> <script setup>
import Logo from '../Logo/index.vue' import Logo from '../Logo/index.vue'
import { inject } from 'vue'
const switchMenu = inject('switchMenu') const switchMenu = inject('switchMenu')
</script> </script>

View File

@ -51,8 +51,6 @@
<script setup> <script setup>
import { deepClone } from '@/util' import { deepClone } from '@/util'
import { computed, getCurrentInstance, onMounted, ref, watch } from 'vue'
import { useStore } from 'vuex'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const store = useStore() const store = useStore()

View File

@ -29,7 +29,6 @@
<script setup> <script setup>
import SidebarItem from './index.vue' import SidebarItem from './index.vue'
import path from 'path-browserify' import path from 'path-browserify'
import { computed, defineProps } from 'vue'
const props = defineProps({ const props = defineProps({
item: { item: {

View File

@ -23,7 +23,6 @@
<script setup> <script setup>
import Logo from '../Logo/index.vue' import Logo from '../Logo/index.vue'
import SidebarItem from '../SidebarItem/index.vue' import SidebarItem from '../SidebarItem/index.vue'
import { ref } from 'vue'
const sidebarScrollTop = ref(0) const sidebarScrollTop = ref(0)

View File

@ -140,10 +140,6 @@
</template> </template>
<script setup> <script setup>
import { computed, getCurrentInstance, inject, onMounted, ref } from 'vue'
import { useStore } from 'vuex'
import { useRoute } from 'vue-router'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const store = useStore() const store = useStore()
const route = useRoute() const route = useRoute()

View File

@ -29,9 +29,6 @@
import { compile } from 'path-to-regexp' import { compile } from 'path-to-regexp'
import { deepClone } from '@/util' import { deepClone } from '@/util'
import UserMenu from '../UserMenu/index.vue' import UserMenu from '../UserMenu/index.vue'
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useStore } from 'vuex'
import { useRoute } from 'vue-router'
const store = useStore() const store = useStore()
const route = useRoute() const route = useRoute()

View File

@ -39,9 +39,6 @@
<script setup> <script setup>
import screenfull from 'screenfull' import screenfull from 'screenfull'
import { computed, inject, onBeforeUnmount, onMounted, ref } from 'vue'
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
const reload = inject('reload') const reload = inject('reload')
const store = useStore() const store = useStore()

View File

@ -39,10 +39,6 @@ import Search from './components/Search/index.vue'
import ThemeSetting from './components/ThemeSetting/index.vue' import ThemeSetting from './components/ThemeSetting/index.vue'
import BuyIt from './components/BuyIt/index.vue' import BuyIt from './components/BuyIt/index.vue'
import { provide, computed, watch, getCurrentInstance, onMounted } from 'vue'
import { useStore } from 'vuex'
import { useRoute, useRouter } from 'vue-router'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const store = useStore() const store = useStore()
const route = useRoute(), router = useRouter() const route = useRoute(), router = useRouter()

View File

@ -0,0 +1,13 @@
import autoImport from 'unplugin-auto-import/vite'
export default function createAutoImport() {
return autoImport({
imports: [
'vue',
'vue-router',
{
'vuex': ['useStore']
}
]
})
}

View File

@ -2,6 +2,7 @@ import vue from '@vitejs/plugin-vue'
import createRestart from './restart' import createRestart from './restart'
import createHtml from './html' import createHtml from './html'
import createAutoImport from './auto-import'
import createComponents from './components' import createComponents from './components'
import createSvgIcon from './svg-icon' import createSvgIcon from './svg-icon'
import createMock from './mock' import createMock from './mock'
@ -13,6 +14,7 @@ export default function createVitePlugins(viteEnv, isBuild = false) {
const vitePlugins = [vue()] const vitePlugins = [vue()]
!isBuild && vitePlugins.push(createRestart()) !isBuild && vitePlugins.push(createRestart())
vitePlugins.push(createHtml(viteEnv, isBuild)) vitePlugins.push(createHtml(viteEnv, isBuild))
vitePlugins.push(createAutoImport())
vitePlugins.push(createComponents()) vitePlugins.push(createComponents())
vitePlugins.push(createSvgIcon(isBuild)) vitePlugins.push(createSvgIcon(isBuild))
vitePlugins.push(createMock()) vitePlugins.push(createMock())