Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
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
2022-05-26 17:08:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
450f6ff06644fcdd900a65571fd744b974db1a3e
450f6ff0
1 parent
7431e577
新增vite插件处理vue3,setup函数中无法写name的问题
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
15 deletions
package.json
src/App.vue
src/views/client/bookDetail.vue
vite.config.js
yarn.lock
package.json
View file @
450f6ff
...
...
@@ -40,6 +40,7 @@
"postcss-px-to-viewport"
:
"^1.1.1"
,
"qs"
:
"^6.10.3"
,
"tslint"
:
"^6.1.3"
,
"unplugin-vue-define-options"
:
"^0.6.1"
,
"vite"
:
"^2.9.9"
,
"vite-plugin-style-import"
:
"1.4.1"
,
"vue-router"
:
"4"
...
...
src/App.vue
View file @
450f6ff
<template>
<!-- 页面缓存 -->
<router-view v-slot="{ Component, route }">
<keep-alive :include="keepPages">
<keep-alive :include="keepPages"
:max="10"
>
<component :is="Component" :key="route.name" />
</keep-alive>
</router-view>
...
...
src/views/client/bookDetail.vue
View file @
450f6ff
...
...
@@ -311,20 +311,6 @@ const goToDetail = (prod_id, book_id, type) => { // 跳转作品详情页
/*****************************************************/
</script>
<script>
export default {
name: 'bookDetail',
data() {
return {
}
},
mounted() {
},
methods: {
}
}
</script>
<style lang="less" scoped>
@import url('@css/content-bg.less');
...
...
vite.config.js
View file @
450f6ff
...
...
@@ -4,6 +4,7 @@ import dynamicImport from 'vite-plugin-dynamic-import';
import
styleImport
,
{
VantResolve
}
from
'vite-plugin-style-import'
;
import
{
defineConfig
,
loadEnv
}
from
'vite'
;
import
{
createProxy
}
from
'./build/proxy'
import
DefineOptions
from
'unplugin-vue-define-options/vite'
;
var
path
=
require
(
'path'
);
...
...
@@ -29,6 +30,7 @@ export default ({ command, mode }) => {
// legacy({
// targets: ['defaults', 'not IE 11']
// }), // Vite 的默认旧版浏览器支持时提供此插件本机ESM的支持。
DefineOptions
(),
// 插件来对组件名进行注册的, 解决setup没法写name的问题
],
publicDir
:
'public'
,
// 作为静态资源服务的文件夹。这个目录中的文件会在开发中被服务于 /,在开发模式时,会被拷贝到 outDir 的根目录,并没有转换,永远只是复制到这里。该值可以是文件系统的绝对路径,也可以是相对于项目的根目录路径。
// cacheDir: '', // 存储缓存文件的目录。此目录下会存储预打包的依赖项或 vite 生成的某些缓存文件,使用缓存可以提高性能。如需重新生成缓存文件,你可以使用 --force 命令行选项或手动删除目录。此选项的值可以是文件的绝对路径,也可以是以项目根目录为基准的相对路径。
...
...
yarn.lock
View file @
450f6ff
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment