Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
hager
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-09-26 15:26:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
78cdd05a241317c26f3625f70995c1e7fcc3433a
78cdd05a
1 parent
b9c0e4c0
✨ feat: 自动按需引入组件
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
9 deletions
.gitignore
components.d.ts
package.json
src/main.js
vite.config.js
yarn.lock
.gitignore
View file @
78cdd05
...
...
@@ -25,3 +25,5 @@ dist-ssr
.history
.vscode
hager
...
...
components.d.ts
0 → 100644
View file @
78cdd05
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export
{}
/* prettier-ignore */
declare
module
'vue'
{
export
interface
GlobalComponents
{
ElCol
:
typeof
import
(
'element-ui/lib/col'
)[
'default'
]
ElRow
:
typeof
import
(
'element-ui/lib/row'
)[
'default'
]
HagerFooter
:
typeof
import
(
'./src/components/common/hagerFooter.vue'
)[
'default'
]
HagerHeader
:
typeof
import
(
'./src/components/common/hagerHeader.vue'
)[
'default'
]
Navbar
:
typeof
import
(
'./src/components/navbar.vue'
)[
'default'
]
RouterLink
:
typeof
import
(
'vue-router'
)[
'RouterLink'
]
RouterView
:
typeof
import
(
'vue-router'
)[
'RouterView'
]
SlideComp
:
typeof
import
(
'./src/components/slideComp.vue'
)[
'default'
]
VideoPlayer
:
typeof
import
(
'./src/components/videoPlayer.vue'
)[
'default'
]
}
}
package.json
View file @
78cdd05
...
...
@@ -22,10 +22,12 @@
"@vitejs/plugin-legacy"
:
"^5.4.2"
,
"@vitejs/plugin-vue"
:
"^5.1.2"
,
"@vitejs/plugin-vue2"
:
"^2.3.1"
,
"babel-plugin-component"
:
"^1.1.1"
,
"less"
:
"^4.2.0"
,
"path-browserify"
:
"^1.0.1"
,
"qs"
:
"^6.13.0"
,
"sass-embedded"
:
"1.55.0"
,
"unplugin-vue-components"
:
"^0.27.4"
,
"vite"
:
"^5.4.1"
,
"vite-plugin-dynamic-import"
:
"^1.5.0"
}
...
...
src/main.js
View file @
78cdd05
/*
* @Date: 2024-08-26 10:12:56
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-09-2
4 18:05:09
* @FilePath: /
vue2_vite_web
/src/main.js
* @LastEditTime: 2024-09-2
6 15:24:16
* @FilePath: /
hager
/src/main.js
* @Description: 文件描述
*/
import
"@babel/polyfill"
;
...
...
@@ -10,13 +10,15 @@ import Vue from "vue";
import
App
from
'./App.vue'
import
VueRouter
from
'vue-router'
import
router
from
'./router'
import
ElementUI
from
'element-ui'
;
import
'element-ui/lib/theme-chalk/index.css'
;
//
import ElementUI from 'element-ui';
//
import 'element-ui/lib/theme-chalk/index.css';
import
'element-ui/lib/theme-chalk/display.css'
;
// 基于断点的隐藏类,用于在某些条件下隐藏元素
import
'@/styles/element-ui/element-variables.scss'
// 自定义主题, 不需要展示屏蔽
// import '@/styles/element-ui/element-variables.scss' // 自定义主题, 不需要展示屏蔽
// import { Button, Row, Col, } from 'element-ui';
Vue
.
use
(
VueRouter
);
Vue
.
use
(
ElementUI
);
// Vue.use(ElementUI);
// Vue.use(Button).use(Row).use(Col)
new
Vue
({
router
,
...
...
vite.config.js
View file @
78cdd05
/*
* @Date: 2024-08-26 10:12:56
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-0
8-29 17:50:26
* @FilePath: /
vue2_vite_web
/vite.config.js
* @LastEditTime: 2024-0
9-26 15:25:44
* @FilePath: /
hager
/vite.config.js
* @Description: 文件描述
*/
// import vue from '@vitejs/plugin-vue'
...
...
@@ -10,7 +10,10 @@ import vue from "@vitejs/plugin-vue2";
import
legacy
from
"@vitejs/plugin-legacy"
;
import
dynamicImport
from
'vite-plugin-dynamic-import'
;
import
{
defineConfig
,
loadEnv
}
from
'vite'
;
import
{
createProxy
}
from
'./build/proxy'
import
{
createProxy
}
from
'./build/proxy'
;
import
Components
from
'unplugin-vue-components/vite'
;
import
{
ElementUiResolver
}
from
'unplugin-vue-components/resolvers'
;
// var path = require('path');
import
path
from
'path-browserify'
;
...
...
@@ -51,6 +54,9 @@ return defineConfig({
],
}),
dynamicImport
(),
Components
({
// 自动按需求引入组件
resolvers
:
[
ElementUiResolver
()],
}),
],
publicDir
:
'public'
,
// 作为静态资源服务的文件夹。这个目录中的文件会在开发中被服务于 /,在开发模式时,会被拷贝到 outDir 的根目录,并没有转换,永远只是复制到这里。该值可以是文件系统的绝对路径,也可以是相对于项目的根目录路径。
// cacheDir: '', // 存储缓存文件的目录。此目录下会存储预打包的依赖项或 vite 生成的某些缓存文件,使用缓存可以提高性能。如需重新生成缓存文件,你可以使用 --force 命令行选项或手动删除目录。此选项的值可以是文件的绝对路径,也可以是以项目根目录为基准的相对路径。
...
...
yarn.lock
View file @
78cdd05
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment