Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
shilixia 2021-09-15 13:39:22 +08:00
commit adb2ec2471
5 changed files with 51 additions and 21 deletions

View File

@ -1,11 +1,29 @@
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view v-if='isRouterAlive'/>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'App' name: 'App',
provide(){
return{
reload:this.reload
}
},
data(){
return{
isRouterAlive:true
}
},
methods:{
reload(){
this.isRouterAlive=false;
this.$nextTick(function () {
this.isRouterAlive=true;
})
},
}
} }
</script> </script>

View File

@ -13,13 +13,14 @@
<script> <script>
export default { export default {
inject:['reload'],
data() { data() {
return { return {
sizeOptions: [ sizeOptions: [
{ label: 'Default', value: 'default' }, { label: '默认', value: 'default' },
{ label: 'Medium', value: 'medium' }, { label: '大号', value: 'medium' },
{ label: 'Small', value: 'small' }, { label: '中号', value: 'small' },
{ label: 'Mini', value: 'mini' } { label: '小号', value: 'mini' }
] ]
} }
}, },
@ -32,21 +33,20 @@ export default {
handleSetSize(size) { handleSetSize(size) {
this.$ELEMENT.size = size; this.$ELEMENT.size = size;
this.$store.dispatch('app/setSize', size); this.$store.dispatch('app/setSize', size);
this.refreshView();
this.$message({ this.$message({
message: 'Switch Size Success', message: 'Switch Size Success',
type: 'success' type: 'success'
}) });
this.reload();
}, },
refreshView() { refreshView() {
// In order to make the cached page re-rendered // In order to make the cached page re-rendered
this.$store.dispatch('tagsView/delAllCachedViews', this.$route); this.$store.dispatch('tagsView/delAllCachedViews', this.$route);
const { fullPath } = this.$route;
const { fullPath } = this.$route
this.$nextTick(() => { this.$nextTick(() => {
location. reload();
this.$router.replace({ this.$router.replace({
path: '/redirect' + fullPath path: fullPath
}) })
}) })
} }

View File

@ -7,9 +7,9 @@
<div class="right-menu"> <div class="right-menu">
<template> <template>
<search id="header-search" class="right-menu-item" /> <search id="header-search" class="right-menu-item" />
<!--<el-tooltip content="Global Size" effect="dark" placement="bottom">--> <el-tooltip content="Global Size" effect="dark" placement="bottom">
<!--<size-select id="size-select" class="right-menu-item hover-effect" />--> <size-select id="size-select" class="right-menu-item hover-effect" />
<!--</el-tooltip>--> </el-tooltip>
</template> </template>
<div class="right-menu-item" > <div class="right-menu-item" >
{{name}} {{name}}
@ -49,7 +49,7 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb' import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger' import Hamburger from '@/components/Hamburger'
// import SizeSelect from '@/components/SizeSelect' import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch' import Search from '@/components/HeaderSearch'
export default { export default {
@ -61,6 +61,7 @@ export default {
components: { components: {
Breadcrumb, Breadcrumb,
Hamburger, Hamburger,
SizeSelect,
Search Search
}, },
computed: { computed: {

View File

@ -1,8 +1,8 @@
import Vue from 'vue' import Vue from 'vue'
import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui' import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n // import locale from 'element-ui/lib/locale/lang/en' // lang i18n
@ -32,8 +32,11 @@ if (process.env.NODE_ENV === 'production') {
// set ElementUI lang to EN // set ElementUI lang to EN
// Vue.use(ElementUI, { locale }) // Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui按如下方式声明 // 如果想要中文版 element-ui按如下方式声明
Vue.use(ElementUI, { size: 'medium' }) // Vue.use(ElementUI, { size: 'medium' })
Vue.config.productionTip = false Vue.use(Element, {
size: Cookies.get('size') || 'medium'
})
Vue.config.productionTip = false;
new Vue({ new Vue({

View File

@ -5,7 +5,8 @@ const state = {
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
withoutAnimation: false withoutAnimation: false
}, },
device: 'desktop' device: 'desktop',
size: Cookies.get('size') || 'medium'
} }
const mutations = { const mutations = {
@ -25,6 +26,10 @@ const mutations = {
}, },
TOGGLE_DEVICE: (state, device) => { TOGGLE_DEVICE: (state, device) => {
state.device = device state.device = device
},
SET_SIZE: (state, size) => {
state.size = size
Cookies.set('size', size)
} }
} }
@ -37,6 +42,9 @@ const actions = {
}, },
toggleDevice({ commit }, device) { toggleDevice({ commit }, device) {
commit('TOGGLE_DEVICE', device) commit('TOGGLE_DEVICE', device)
},
setSize({ commit }, size) {
commit('SET_SIZE', size)
} }
} }