feature: add fixedHeader settings
This commit is contained in:
parent
3594052c90
commit
d919acf64b
|
@ -74,57 +74,60 @@ export default {
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
.rightPanel-background {
|
.rightPanel-background {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity .3s cubic-bezier(.7,.3,.1,1);
|
transition: opacity .3s cubic-bezier(.7, .3, .1, 1);
|
||||||
background: rgba(0, 0, 0, .2);
|
background: rgba(0, 0, 0, .2);
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
position: fixed;
|
top: 0;
|
||||||
z-index: -1;
|
left: 0;
|
||||||
}
|
position: fixed;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
.rightPanel {
|
.rightPanel {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
z-index: 3000;
|
z-index: 3000;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 260px;
|
max-width: 260px;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, .05);
|
box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, .05);
|
||||||
transition: all .25s cubic-bezier(.7,.3,.1,1);
|
transition: all .25s cubic-bezier(.7, .3, .1, 1);
|
||||||
transform: translate(100%);
|
transform: translate(100%);
|
||||||
z-index: 40000;
|
z-index: 40000;
|
||||||
left: auto;
|
left: auto;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.show {
|
.show {
|
||||||
|
|
||||||
transition: all .3s cubic-bezier(.7,.3,.1,1);
|
transition: all .3s cubic-bezier(.7, .3, .1, 1);
|
||||||
.rightPanel-background {
|
|
||||||
z-index: 20000;
|
|
||||||
opacity: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rightPanel {
|
.rightPanel-background {
|
||||||
transform: translate(0);
|
z-index: 20000;
|
||||||
}
|
opacity: 1;
|
||||||
}
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.handle-button {
|
.rightPanel {
|
||||||
position: absolute;
|
transform: translate(0);
|
||||||
left: -48px;
|
}
|
||||||
border-radius: 6px 0 0 6px !important;
|
}
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
.handle-button {
|
||||||
pointer-events: auto;
|
position: absolute;
|
||||||
z-index: 0;
|
left: -48px;
|
||||||
font-size: 24px;
|
border-radius: 6px 0 0 6px !important;
|
||||||
text-align: center;
|
width: 48px;
|
||||||
}
|
height: 48px;
|
||||||
|
pointer-events: auto;
|
||||||
|
z-index: 0;
|
||||||
|
font-size: 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
|
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
|
||||||
<sidebar class="sidebar-container" />
|
<sidebar class="sidebar-container" />
|
||||||
<div :class="{hasTagsView:needTagsView}" class="main-container">
|
<div :class="{hasTagsView:needTagsView}" class="main-container">
|
||||||
<navbar />
|
<div :class="{'fixed-header':fixedHeader}">
|
||||||
<tags-view v-if="needTagsView" />
|
<navbar />
|
||||||
|
<tags-view v-if="needTagsView" />
|
||||||
|
</div>
|
||||||
<app-main />
|
<app-main />
|
||||||
<right-panel v-if="showSettings">
|
<right-panel v-if="showSettings">
|
||||||
<settings />
|
<settings />
|
||||||
|
@ -35,7 +37,8 @@ export default {
|
||||||
sidebar: state => state.app.sidebar,
|
sidebar: state => state.app.sidebar,
|
||||||
device: state => state.app.device,
|
device: state => state.app.device,
|
||||||
showSettings: state => state.settings.showSettings,
|
showSettings: state => state.settings.showSettings,
|
||||||
needTagsView: state => state.settings.tagsView
|
needTagsView: state => state.settings.tagsView,
|
||||||
|
fixedHeader: state => state.settings.fixedHeader
|
||||||
}),
|
}),
|
||||||
classObj() {
|
classObj() {
|
||||||
return {
|
return {
|
||||||
|
@ -56,6 +59,8 @@ export default {
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
@import "~@/styles/mixin.scss";
|
@import "~@/styles/mixin.scss";
|
||||||
|
@import "~@/styles/variables.scss";
|
||||||
|
|
||||||
.app-wrapper {
|
.app-wrapper {
|
||||||
@include clearfix;
|
@include clearfix;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -75,4 +80,15 @@ export default {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
.fixed-header{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 9;
|
||||||
|
width: calc(100% - #{$sideBarWidth});
|
||||||
|
transition: width 0.28s;
|
||||||
|
}
|
||||||
|
.hideSidebar .fixed-header{
|
||||||
|
width: calc(100% - 54px)
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
.app-main {
|
.app-main {
|
||||||
/*50= navbar 50 */
|
/*50= navbar 50 */
|
||||||
min-height: calc(100vh - 50px);
|
min-height: calc(100vh - 50px);
|
||||||
|
@ -31,9 +31,19 @@ export default {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hasTagsView .app-main {
|
.fixed-header+.app-main {
|
||||||
/*84 = navbar + tags-view = 50 + 34 */
|
margin-top: 50px;
|
||||||
min-height: calc(100vh - 84px);
|
}
|
||||||
|
|
||||||
|
.hasTagsView {
|
||||||
|
.app-main {
|
||||||
|
/*84 = navbar + tags-view = 50 + 34 */
|
||||||
|
min-height: calc(100vh - 84px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-header+.app-main {
|
||||||
|
margin-top: 80px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,8 @@ export default {
|
||||||
.navbar {
|
.navbar {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
background: #fff;
|
||||||
box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
box-shadow: 0 1px 4px rgba(0,21,41,.08);
|
||||||
|
|
||||||
.hamburger-container {
|
.hamburger-container {
|
||||||
|
|
|
@ -5,15 +5,21 @@
|
||||||
系统布局配置
|
系统布局配置
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
<div class="drawer-item">
|
||||||
|
<span>主题色</span>
|
||||||
|
<theme-picker style="float: right;height: 26px;margin: -3px 5px 0 0;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="drawer-item">
|
<div class="drawer-item">
|
||||||
<span>开启 Tags-View</span>
|
<span>开启 Tags-View</span>
|
||||||
<el-switch v-model="tagsView" class="drawer-switch" />
|
<el-switch v-model="tagsView" class="drawer-switch" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="drawer-item">
|
<div class="drawer-item">
|
||||||
<span>主题色</span>
|
<span>固定 Header</span>
|
||||||
<theme-picker style="float: right;height: 26px;margin: -3px 5px 0 0;" />
|
<el-switch v-model="fixedHeader" class="drawer-switch" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -29,6 +35,17 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
fixedHeader: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.settings.fixedHeader
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$store.dispatch('settings/changeSetting', {
|
||||||
|
key: 'fixedHeader',
|
||||||
|
value: val
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
tagsView: {
|
tagsView: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.settings.tagsView
|
return this.$store.state.settings.tagsView
|
||||||
|
|
|
@ -13,6 +13,12 @@ export default {
|
||||||
*/
|
*/
|
||||||
tagsView: true,
|
tagsView: true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean} true | false
|
||||||
|
* @description Whether fix the header
|
||||||
|
*/
|
||||||
|
fixedHeader: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string | array} 'production' | ['production','development']
|
* @type {string | array} 'production' | ['production','development']
|
||||||
* @description Need show err logs component.
|
* @description Need show err logs component.
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
const { showSettings, tagsView } = defaultSettings
|
const { showSettings, tagsView, fixedHeader } = defaultSettings
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
showSettings: showSettings,
|
showSettings: showSettings,
|
||||||
tagsView: tagsView
|
tagsView: tagsView,
|
||||||
|
fixedHeader: fixedHeader
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
|
Loading…
Reference in New Issue