提交 4f3bfdea 编写于 作者: inkwalk's avatar inkwalk

add: set windows style apis

上级 b56cf24a
......@@ -171,7 +171,10 @@ const ui = [
'showRightWindow',
'hideTopWindow',
'hideLeftWindow',
'hideRightWindow'
'hideRightWindow',
'setTopWindowStyle',
'setLeftWindowStyle',
'setRightWindowStyle'
]
const event = [
......
......@@ -274,6 +274,15 @@ export default {
}
}
},
setWindowStyle (type, style) {
if (!this[type + 'Window']) {
return type + 'Window not found'
}
if (style) {
this[type + 'WindowStyle'] = style
this.$nextTick(this['on' + capitalize(type) + 'WindowInit'])
}
},
initMaxWidth () {
window.addEventListener('resize', () => {
this.checkMaxWidth()
......
......@@ -41,3 +41,30 @@ export function showRightWindow () {
export function hideRightWindow () {
return showWindow('right', false)
}
function setWindowStyle (type, style) {
const api = 'set' + capitalize(type) + 'WindowStyle'
const app = getApp()
if (!app) {
return {
errMsg: `${api}:fail app not ready`
}
}
const msg = app.$children[0].$refs.layout.setWindowStyle(type, style)
if (msg) {
return {
errMsg: `${api}:fail ${msg}`
}
}
return {}
}
export function setTopWindowStyle (style) {
return setWindowStyle('top', style)
}
export function setLeftWindowStyle (style) {
return setWindowStyle('left', style)
}
export function setRightWindowStyle (style) {
return setWindowStyle('right', style)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册