hookehuyr

新增vite插件处理vue3,setup函数中无法写name的问题

......@@ -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"
......
<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>
......
......@@ -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');
......
......@@ -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 命令行选项或手动删除目录。此选项的值可以是文件的绝对路径,也可以是以项目根目录为基准的相对路径。
......
This diff is collapsed. Click to expand it.