optimize packaging
This commit is contained in:
parent
85641755a3
commit
4e91e81e45
@ -1,2 +1,2 @@
|
||||
ENV = 'development'
|
||||
NODE_ENV = 'development'
|
||||
VUE_APP_TYPE = 'frpc'
|
@ -1,2 +1,2 @@
|
||||
ENV = 'development'
|
||||
NODE_ENV = 'development'
|
||||
VUE_APP_TYPE = 'frps'
|
||||
|
@ -1,2 +1,2 @@
|
||||
ENV = 'production'
|
||||
NODE_ENV = 'production'
|
||||
VUE_APP_TYPE = 'frpc'
|
@ -1,2 +1,2 @@
|
||||
ENV = 'production'
|
||||
NODE_ENV = 'production'
|
||||
VUE_APP_TYPE = 'frps'
|
@ -13,7 +13,6 @@
|
||||
|
||||
<script>
|
||||
import { Navbar, Sidebar, AppMain } from './components'
|
||||
import ResizeMixin from './mixin/ResizeHandler'
|
||||
|
||||
export default {
|
||||
name: 'Layout',
|
||||
@ -22,7 +21,6 @@ export default {
|
||||
Sidebar,
|
||||
AppMain
|
||||
},
|
||||
mixins: [ResizeMixin],
|
||||
computed: {
|
||||
sidebar() {
|
||||
return this.$store.state.app.sidebar
|
||||
|
@ -1,45 +0,0 @@
|
||||
import store from '@/store'
|
||||
|
||||
const { body } = document
|
||||
const WIDTH = 992 // refer to Bootstrap's responsive design
|
||||
|
||||
export default {
|
||||
watch: {
|
||||
$route(route) {
|
||||
if (this.device === 'mobile' && this.sidebar.opened) {
|
||||
store.dispatch('app/closeSideBar', { withoutAnimation: false })
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
window.addEventListener('resize', this.$_resizeHandler)
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('resize', this.$_resizeHandler)
|
||||
},
|
||||
mounted() {
|
||||
const isMobile = this.$_isMobile()
|
||||
if (isMobile) {
|
||||
store.dispatch('app/toggleDevice', 'mobile')
|
||||
store.dispatch('app/closeSideBar', { withoutAnimation: true })
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// use $_ for mixins properties
|
||||
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
|
||||
$_isMobile() {
|
||||
const rect = body.getBoundingClientRect()
|
||||
return rect.width - 1 < WIDTH
|
||||
},
|
||||
$_resizeHandler() {
|
||||
if (!document.hidden) {
|
||||
const isMobile = this.$_isMobile()
|
||||
store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop')
|
||||
|
||||
if (isMobile) {
|
||||
store.dispatch('app/closeSideBar', { withoutAnimation: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ function getProxyTargetPort() {
|
||||
module.exports = {
|
||||
publicPath: './',
|
||||
outputDir: `./dist/${appType}`,
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
host: '127.0.0.1',
|
||||
port: 8010,
|
||||
|
Loading…
Reference in New Issue
Block a user