【更新】兼容formStyle

pull/103/head^2
xlzy 2 years ago committed by 小诺
parent 48736f6519
commit 96fa681a91

@ -78,15 +78,15 @@
<a-form-item label="菜单排他展开">
<a-switch :checked="sideUniqueOpen" @change="toggleState('sideUniqueOpen')" />
</a-form-item>
<a-form-item label="表单风格">
<a-select
v-model:value="formStyle"
style="width: 80px"
size="small"
:options="xnFormStyleOptions"
@change="formStyleChange"
/>
</a-form-item>
<a-form-item label="表单风格">
<a-select
:value="formStyle"
class="w-[80px]"
size="small"
:options="xnFormStyleOptions"
@change="formStyleChange"
/>
</a-form-item>
</a-form>
<a-alert
message="以上配置可实时预览,开发者可在 config/index.js 中配置默认值,不建议在生产环境下开放布局设置"
@ -101,7 +101,7 @@
import { ThemeModeEnum } from '../../utils/enum'
import { globalStore } from '@/store'
import { mapState, mapStores } from 'pinia'
import tool from '@/utils/tool'
import tool from '@/utils/tool'
const toolDataNameMap = {
menuIsCollapse: 'MENU_COLLAPSE',
@ -147,16 +147,16 @@
style: 'snowy-setting-layout-menu-doublerow'
}
],
xnFormStyleOptions: [
{
label: '抽屉',
value: 'drawer'
},
{
label: '对话框',
value: 'modal'
}
],
xnFormStyleOptions: [
{
label: '抽屉',
value: 'drawer'
},
{
label: '对话框',
value: 'modal'
}
],
colorList
}
},
@ -172,7 +172,8 @@
'breadcrumbOpen',
'moduleUnfoldOpen',
'topHanderThemeColorOpen',
'topHanderThemeColorSpread'
'topHanderThemeColorSpread',
'formStyle'
])
},
mounted() {},
@ -186,31 +187,31 @@
toggleState(stateName) {
this.globalStore.toggleConfig(stateName)
const toolDataName = toolDataNameMap[stateName]
tool.data.set(`SNOWY_${toolDataName}`, this.globalStore[stateName])
tool.data.set(`SNOWY_${toolDataName}`, this.globalStore[stateName])
},
//
//
setSideStyle(value) {
this.globalStore.setTheme(value)
this.sideStyle = value
tool.data.set('SNOWY_THEME', value)
tool.data.set('SNOWY_THEME', value)
},
//
//
layoutStyle(value) {
this.globalStore.setLayout(value)
tool.data.set('SNOWY_LAYOUT', value)
tool.data.set('SNOWY_LAYOUT', value)
this.layout = value
},
//
//
tagColor(value) {
this.globalStore.themeColor = value
tool.data.set('SNOWY_THEME_COLOR', value)
tool.data.set('SNOWY_THEME_COLOR', value)
this.globalStore.setThemeColor(value)
},
//
formStyleChange(value) {
tool.data.set('SNOWY_FORM_STYLE', value)
this.$store.commit('SET_formStyle', value)
}
//
formStyleChange(value) {
tool.data.set('SNOWY_FORM_STYLE', value)
this.globalStore.setFormStyle(value)
}
}
})
</script>

@ -42,6 +42,8 @@ export const globalStore = defineStore({
theme: getCacheConfig('SNOWY_THEME'),
// 主题颜色
themeColor: toolDataGet('SNOWY_THEME_COLOR') || config.COLOR,
// 整体表单风格
formStyle: getCacheConfig('SNOWY_FORM_STYLE'),
// 用户信息
userInfo: toolDataGet('USER_INFO') || {},
// 系统配置
@ -72,23 +74,8 @@ export const globalStore = defineStore({
toggleConfig(key) {
this[key] = !this[key]
},
toggle_SideUniqueOpen() {
this.sideUniqueOpen = !this.sideUniqueOpen
},
toggle_LayoutTagsOpen() {
this.layoutTagsOpen = !this.layoutTagsOpen
},
toggle_BreadcrumbOpen() {
this.breadcrumbOpen = !this.breadcrumbOpen
},
toggle_TopHanderThemeColorOpen() {
this.topHanderThemeColorOpen = !this.topHanderThemeColorOpen
},
toggle_TopHanderThemeColorSpread() {
this.topHanderThemeColorSpread = !this.topHanderThemeColorSpread
},
toggle_ModuleUnfoldOpen() {
this.moduleUnfoldOpen = !this.moduleUnfoldOpen
setFormStyle(key) {
this.formStyle = key
},
setUserInfo(key) {
this.userInfo = key

Loading…
Cancel
Save