feature:优化细节

This commit is contained in:
zouzhibing 2022-08-24 18:53:05 +08:00
parent f945e92e08
commit 264806b275
6 changed files with 40 additions and 20 deletions

View File

@ -13,8 +13,12 @@
</div>
</div>
<el-drawer v-model="drawer" title="主题配置" size="300px">
<div class="drawer-item">
<label>布局</label>
<div class="theme-item">
<label>标签</label>
<el-color-picker v-model="themeConfig.primary" :predefine="colorList" @change="changePrimary" />
</div>
<div class="theme-item">
<label>菜单布局</label>
<el-select
v-model="layout"
placeholder="请选择"
@ -25,7 +29,7 @@
<el-option label="横向" value="horizontal"></el-option>
</el-select>
</div>
<div class="drawer-item">
<div class="theme-item">
<label>标签</label>
<el-switch v-model="tag" @change="(val) => changeSwitch(val, 1)" />
</div>
@ -34,7 +38,7 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import {computed, ref} from 'vue'
const drawer = ref(false)
const tag = ref(true)
const layout = ref('vertical')
@ -52,6 +56,8 @@
}
}
const themeConfig = computed(()=>store.state.setting.themeConfig)
const changeSwitch = (val, type) => {
switch (type) {
// tag
@ -116,11 +122,18 @@
box-shadow 0.15s ease;
}
}
.drawer-item {
::v-deep(.el-drawer__title) {
font-weight: bold;
color: black;
}
.theme-item {
width: 100%;
display: flex;
margin-bottom: 15px;
align-items: center;
font-size: 14px;
color: black;
justify-content: space-between;
}
</style>

View File

@ -38,7 +38,7 @@
</el-dropdown>
</div>
</div>
<tag-views v-if="isShowTag" />
<tag-views v-if="showTag" />
<personal ref="person" />
</div>
</template>
@ -64,11 +64,11 @@
return !store.state.app.isCollapse
})
const mode = computed(() => {
return store.state.setting.mode
return store.state.setting.themeConfig.mode
})
const isShowTag = computed(() => {
return store.state.setting.isShowTag
const showTag = computed(() => {
return store.state.setting.themeConfig.showTag
})
const userInfo = computed(() => {

View File

@ -8,12 +8,12 @@
<component :is="Component" :key="route.path" v-else />
</transition>
</router-view>
<u-setting />
<u-theme />
</section>
</template>
<script lang="ts" setup>
import USetting from '@/components/u-setting/index.vue'
import UTheme from '@/components/u-theme/index.vue'
import { useStore } from 'vuex'
import { computed, ref } from 'vue'
const store = useStore()

View File

@ -31,7 +31,6 @@
//
const permission_routes = computed(() => {
console.log('permission_routes', store.state.permission.routes)
return store.state.permission.routes
})
@ -51,6 +50,6 @@
//
const mode = computed(() => {
return store.state.setting.mode
return store.state.setting.themeConfig.mode
})
</script>

View File

@ -9,7 +9,7 @@
}"
>
<u-header />
<div class="m-container-content" :class="{ 'app-main-hide-tag': !isShowTag }">
<div class="m-container-content" :class="{ 'app-main-hide-tag': !showTag }">
<u-main />
</div>
</div>
@ -51,18 +51,18 @@
const handleClickOutside = () => {
store.dispatch('app/closeSideBar', { withoutAnimation: false })
}
const isShowTag = computed(() => {
return store.state.setting.isShowTag
const showTag = computed(() => {
return store.state.setting.themeConfig.showTag
})
const mode = computed(() => {
return store.state.setting.mode
return store.state.setting.themeConfig.mode
})
return {
isCollapse,
device,
classObj,
isShowTag,
showTag,
mode,
handleClickOutside,
}

View File

@ -1,16 +1,24 @@
import {Module} from "vuex";
const state = {
themeConfig:{
// 菜单展示模式 默认 vertical horizontal / vertical
mode: 'vertical',
// tagsView 是否展示
showTag:true, // 默认展示
// 页脚
footer: true
},
isShowTag: true,
mode: 'vertical',
}
const mutations = {
SET_TAG: (state, value) => {
state.isShowTag = value
state.themeConfig.showTag = value
},
SET_MODE: (state, value) => {
state.mode = value
state.themeConfig.mode = value
},
}
const actions = {