提交 31b94843 编写于 作者: Q qiang

Merge branch 'dev' into alpha

### uni.setTopWindowStyle(OBJECT)
## 窗口样式相关的 API
设置 topWindow 的样式
获取对应窗口的样式,返回一个 css 属性值对象;
设置对应窗口的样式,传入一个 css 属性值对象
> 3.0.5 新增
### uni.getTopWindowStyle()
获取 topWindow 的样式
> 未发布
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.getTopWindowStyle()
```
### uni.getLeftWindowStyle()
获取 leftWindow 的样式
> 未发布
**平台差异说明**
......@@ -10,6 +33,36 @@
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.getLeftWindowStyle()
```
### uni.getRightWindowStyle()
获取 rightWindow 的样式
> 未发布
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.getRightWindowStyle()
```
### uni.setTopWindowStyle(OBJECT)
设置 topWindow 的样式
> 3.0.5 新增
**OBJECT 参数说明**
|参数|类型|说明|
......@@ -52,7 +105,6 @@ uni.setLeftWindowStyle({
})
```
### uni.setRightWindowStyle(OBJECT)
设置 rightWindow 的样式
......@@ -79,3 +131,117 @@ uni.setRightWindowStyle({
backgroundColor: 'blue'
})
```
<!--
## 显示或隐藏窗口的 API
显示或隐藏对应的窗口
### uni.showTopWindow()
显示 topWindow
> 3.0.5 新增
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.showTopWindow()
```
### uni.showLeftWindow()
显示 leftWindow
> 3.0.5 新增
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.showLeftWindow()
```
### uni.showRightWindow()
显示 rightWindow
> 3.0.5 新增
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.showRightWindow()
```
### uni.hideTopWindow()
隐藏 topWindow
> 3.0.5 新增
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.hideTopWindow()
```
### uni.hideLeftWindow()
隐藏 leftWindow
> 3.0.5 新增
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.hideLeftWindow()
```
### uni.hideRightWindow()
隐藏 rightWindow
> 3.0.5 新增
**平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|x|√|x|x|x|x|x|
**代码示例**
```javascript
uni.hideRightWindow()
```
-->
......@@ -174,6 +174,9 @@ const ui = [
'hideTopWindow',
'hideLeftWindow',
'hideRightWindow',
'getTopWindowStyle',
'getLeftWindowStyle',
'getRightWindowStyle',
'setTopWindowStyle',
'setLeftWindowStyle',
'setRightWindowStyle'
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
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$/;
......
......@@ -29,7 +29,10 @@ const attrs = [
'field',
'getcount',
'orderby',
'where'
'where',
'groupby',
'groupField',
'distinct'
]
export default {
......@@ -96,6 +99,18 @@ export default {
manual: {
type: Boolean,
default: false
},
groupby: {
type: String,
default: ''
},
groupField: {
type: String,
default: ''
},
distinct: {
type: [Boolean, String],
default: false
}
},
data () {
......@@ -380,6 +395,15 @@ export default {
if (this.field) {
db = db.field(this.field)
}
if (this.groupby) {
db = db.groupby(this.groupby)
}
if (this.groupField) {
db = db.groupField(this.groupField)
}
if (this.distinct === true) {
db = db.distinct()
}
if (this.orderby) {
db = db.orderBy(this.orderby)
}
......
......@@ -232,7 +232,7 @@ const promiseInterceptor = {
};
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$/;
......@@ -1549,25 +1549,9 @@ function initBehaviors (vueOptions, initBehavior) {
}
});
}
if (isPlainObject(vueExtends) && vueExtends.props) {
behaviors.push(
initBehavior({
properties: initProperties(vueExtends.props, true)
})
);
}
if (Array.isArray(vueMixins)) {
vueMixins.forEach(vueMixin => {
if (isPlainObject(vueMixin) && vueMixin.props) {
behaviors.push(
initBehavior({
properties: initProperties(vueMixin.props, true)
})
);
}
});
{ // alipay 重复定义props会报错,下边的代码对于其他平台也没有意义,保险起见,仅对alipay做处理
return
}
return behaviors
}
function parsePropType (key, type, defaultValue, file) {
......@@ -2100,20 +2084,6 @@ function initRefs () {
}
function initBehavior ({
properties
}) {
const props = {};
Object.keys(properties).forEach(key => {
props[key] = properties[key].value;
});
return {
props
}
}
function initRelation (detail) {
this.props.onVueInit(detail);
}
......@@ -2424,7 +2394,7 @@ function parsePage (vuePageOptions) {
const [VueComponent, vueOptions] = initVueComponent(Vue, vuePageOptions);
const pageOptions = {
mixins: initBehaviors(vueOptions, initBehavior),
mixins: initBehaviors(vueOptions),
data: initData(vueOptions, Vue.prototype),
onLoad (query) {
const properties = this.props;
......@@ -2562,7 +2532,7 @@ function parseComponent (vueComponentOptions) {
});
const componentOptions = {
mixins: initBehaviors(vueOptions, initBehavior),
mixins: initBehaviors(vueOptions),
data: initData(vueOptions, Vue.prototype),
props,
didMount () {
......
......@@ -232,7 +232,7 @@ const promiseInterceptor = {
};
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$/;
......
......@@ -232,7 +232,7 @@ const promiseInterceptor = {
};
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$/;
......
......@@ -232,7 +232,7 @@ const promiseInterceptor = {
};
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$/;
......
......@@ -232,7 +232,7 @@ const promiseInterceptor = {
};
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$/;
......
......@@ -232,7 +232,7 @@ const promiseInterceptor = {
};
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$/;
......
......@@ -231,7 +231,7 @@ const promiseInterceptor = {
};
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$/;
......
......@@ -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$/
......
......@@ -177,6 +177,9 @@ export function initBehaviors (vueOptions, initBehavior) {
}
})
}
if (__PLATFORM__ === 'mp-alipay') { // alipay 重复定义props会报错,下边的代码对于其他平台也没有意义,保险起见,仅对alipay做处理
return
}
if (isPlainObject(vueExtends) && vueExtends.props) {
behaviors.push(
initBehavior({
......@@ -569,4 +572,4 @@ export function handleEvent (event) {
) {
return ret[0]
}
}
}
......@@ -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.
先完成此消息的编辑!
想要评论请 注册