提交 30c28c02 编写于 作者: inkwalk's avatar inkwalk

add: uni.setLeft|Right|TopWindowStyle api

上级 8e7c1d3e
......@@ -174,6 +174,9 @@ const ui = [
'hideTopWindow',
'hideLeftWindow',
'hideRightWindow',
'getTopWindowStyle',
'getLeftWindowStyle',
'getRightWindowStyle',
'setTopWindowStyle',
'setLeftWindowStyle',
'setRightWindowStyle'
......
......@@ -8,7 +8,7 @@ import {
} from './interceptor'
const SYNC_API_RE =
/^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
/^\$|Window$|WindowStyle$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/
const CONTEXT_API_RE = /^create|Manager$/
......
......@@ -274,6 +274,13 @@ export default {
}
}
},
getWindowStyle (type) {
if (!this[type + 'Window']) {
return type + 'Window not found'
}
const style = Object.assign({}, this[type + 'WindowStyle'])
return style
},
setWindowStyle (type, style) {
if (!this[type + 'Window']) {
return type + 'Window not found'
......
......@@ -42,6 +42,33 @@ export function hideRightWindow () {
return showWindow('right', false)
}
function getWindowStyle (type) {
const api = 'get' + capitalize(type) + 'WindowStyle'
const app = getApp()
if (!app) {
return {
errMsg: `${api}:fail app not ready`
}
}
const msg = app.$children[0].$refs.layout.getWindowStyle(type)
if (typeof msg === 'string' && msg.indexOf('Window not found') !== -1) {
return {
errMsg: `${api}:fail ${msg}`
}
}
return msg
}
export function getTopWindowStyle (style) {
return getWindowStyle('top')
}
export function getLeftWindowStyle (style) {
return getWindowStyle('left')
}
export function getRightWindowStyle (style) {
return getWindowStyle('right')
}
function setWindowStyle (type, style) {
const api = 'set' + capitalize(type) + 'WindowStyle'
const app = getApp()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册