修改tagsView
This commit is contained in:
parent
bde9954e83
commit
fe9a1fa88e
|
|
@ -1,2 +1,5 @@
|
|||
# 本地环境
|
||||
NODE_ENV = 'development'
|
||||
|
||||
# 本地环境接口地址
|
||||
VITE_API_URL = '/api'
|
||||
|
|
|
|||
|
|
@ -5,8 +5,12 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build:dev": "vite build --mode development",
|
||||
"build:test": "vite build --mode test",
|
||||
"build:prod": "vite build --mode production",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"build:ts": "vue-tsc --noEmit --skipLibCheck && vite build",
|
||||
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx --fix",
|
||||
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
||||
|
|
@ -16,7 +16,9 @@
|
|||
@click="routerGo(tag)"
|
||||
>
|
||||
<div class="tags-view-item">{{ tag.title }}</div>
|
||||
<el-icon @click.prevent.stop="(e) => closeSelectedTag(e, tag)" class="tag-icon">
|
||||
<el-icon
|
||||
v-if="!isAffix(tag)"
|
||||
@click.prevent.stop="(e) => closeSelectedTag(e, tag)" class="tag-icon">
|
||||
<circle-close-filled
|
||||
/></el-icon>
|
||||
</div>
|
||||
|
|
@ -169,11 +171,9 @@
|
|||
}
|
||||
|
||||
// 关闭所有 去首页
|
||||
const closeAllTab = ()=>{
|
||||
if(route.fullPath!=='/home'){
|
||||
TagsViewStore.delAllViews()
|
||||
}
|
||||
router.push('/')
|
||||
const closeAllTab = async ()=>{
|
||||
let visitedViews = await TagsViewStore.delAllViews()
|
||||
toLastView(visitedViews,route)
|
||||
}
|
||||
|
||||
const routerGo = (tag) => {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import externalLink from './modules/externalLink'
|
|||
* meta ==> 路由元信息
|
||||
* meta.title ==> 路由标题
|
||||
* meta.icon ==> 菜单icon
|
||||
* meta.affix ==> 如果设置为true将会出现在 标签栏中
|
||||
*/
|
||||
|
||||
export const constantRoutes: Array<RouteRecordRaw&extendRoute> = [
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ export const useTagsViewStore = defineStore({
|
|||
delVisitedView(view){
|
||||
return new Promise(resolve => {
|
||||
this.visitedViews = this.visitedViews.filter(v=>{
|
||||
return v.path !== view.path
|
||||
return (v.path !== view.path||v.meta.affix)
|
||||
})
|
||||
this.cachedViews = this.cachedViews.filter(v=>{
|
||||
return v.path !== view.path
|
||||
return (v.path !== view.path||v.meta.affix)
|
||||
})
|
||||
resolve([...this.visitedViews])
|
||||
})
|
||||
|
|
@ -69,8 +69,9 @@ export const useTagsViewStore = defineStore({
|
|||
},
|
||||
delAllViews(){
|
||||
return new Promise((resolve) => {
|
||||
this.visitedViews = []
|
||||
this.visitedViews = []
|
||||
this.visitedViews = this.visitedViews.filter(v=>v.meta.affix)
|
||||
console.log('===============',this.visitedViews)
|
||||
this.cachedViews = this.visitedViews.filter(v=>v.meta.affix)
|
||||
resolve([...this.visitedViews])
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { defineConfig,ConfigEnv, UserConfig } from 'vite'
|
||||
import { defineConfig,ConfigEnv, UserConfig,loadEnv } from 'vite'
|
||||
// vite.config.ts中无法使用import.meta.env 所以需要引入
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
// import AutoImport from 'unplugin-auto-import/vite'
|
||||
// import Components from 'unplugin-vue-components/vite'
|
||||
|
|
@ -75,9 +76,9 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|||
},
|
||||
// 生产环境打包配置
|
||||
//去除 console debugger
|
||||
esbuild: {
|
||||
pure:mode==='production' ? ["console.log", "debugger"] : []
|
||||
},
|
||||
// esbuild: {
|
||||
// pure:mode==='production' ? ["console.log", "debugger"] : []
|
||||
// },
|
||||
|
||||
// build: {
|
||||
// terserOptions: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue