提交 cb4edcea 编写于 作者: Q qiang

Merge branch 'dev' of github.com:dcloudio/uni-app into dev

......@@ -3,12 +3,64 @@
</template>
<script>
const attrs = [
'titleIcon',
'titleIconRadius',
'subtitleText',
'subtitleSize',
'subtitleColor',
'subtitleOverflow',
'titleAlign',
'backgroundImage',
'backgroundRepeat',
'blurEffect'
]
export default {
props: {
title: {
type: String,
default: ''
},
titleIcon: {
type: String,
default: ''
},
titleIconRadius: {
type: String,
default: ''
},
subtitleText: {
type: String,
default: ''
},
subtitleSize: {
type: String,
default: ''
},
subtitleColor: {
type: String,
default: ''
},
subtitleOverflow: {
type: String,
default: ''
},
titleAlign: {
type: String,
default: ''
},
backgroundImage: {
type: String,
default: ''
},
backgroundRepeat: {
type: String,
default: ''
},
blurEffect: {
type: String,
default: ''
},
loading: {
type: Boolean,
default: false
......@@ -31,6 +83,7 @@ export default {
}
},
created () {
const page = getCurrentPages()[0]
this.$watch('title', () => {
this.setNavigationBarTitle()
})
......@@ -46,6 +99,21 @@ export default {
() => {
this.setNavigationBarColor()
})
// #ifdef APP-PLUS
this._webview = page.$getAppWebview()
attrs.forEach(key => {
let titleNView = {}
if (this[key] || this[key].length > 0){
titleNView[key] = this[key]
}
this.setTitleNView(titleNView)
this.$watch(key, (val) => {
let titleStyle = {}
titleStyle[key] = val
this.setTitleNView(titleStyle)
})
})
// #endif
},
beforeMount () {
this.title && this.setNavigationBarTitle()
......@@ -70,6 +138,15 @@ export default {
timingFunc: this.colorAnimationTimingFunc
}
})
},
setTitleNView (titleNView) {
const webview = this._webview
const style = webview.getStyle()
if (style && style.titleNView) {
webview.setStyle({
titleNView: titleNView
})
}
}
}
}
......
......@@ -53,6 +53,10 @@ export default {
pageStyle: {
type: String,
default: ''
},
enablePullDownRefresh: {
type: [Boolean, String],
default: false
},
rootFontSize: {
type: String,
......@@ -77,7 +81,17 @@ export default {
// 父节点一定是 page
this.$pageVm.$on('hook:onPageScroll', evt => {
this.$emit('scroll', evt)
})
})
// #ifdef APP-PLUS
this._currentWebview = page.$getAppWebview()
if (this.enablePullDownRefresh) {
this.setPullDownRefresh(this._currentWebview, true)
}
this.$watch('enablePullDownRefresh', (val) => {
this.setPullDownRefresh(this._currentWebview, val)
})
// #endif
// props
......@@ -112,7 +126,15 @@ export default {
this.backgroundTextStyle && this.setBackgroundTextStyle()
this.scrollTop && this.pageScrollTo()
},
methods: {
methods: {
setPullDownRefresh (webview, enabled) {
webview.setStyle({
pullToRefresh: {
support: enabled,
style: plus.os.name === 'Android' ? 'circle' : 'default'
}
})
},
setPageMeta () {
// h5 和 app-plus 设置 rootFontSize
// #ifdef H5 || APP-PLUS
......
......@@ -2,13 +2,9 @@ import {
invoke
} from 'uni-core/service/bridge'
import {
onMethod
} from 'uni-core/service/platform'
const callbacks = []
onMethod('uniMPNativeEvent', function (res) {
// 不使用uni-core/service/platform中的onMethod,避免循环引用
UniServiceJSBridge.on('api.uniMPNativeEvent', function (res) {
callbacks.forEach(callbackId => {
invoke(callbackId, res.event, res.data)
})
......
......@@ -5,7 +5,7 @@ import {
const isAndroid = plus.os.name.toLowerCase() === 'android'
const FOCUS_TIMEOUT = isAndroid ? 300 : 700
const HIDE_TIMEOUT = 800
const HIDE_TIMEOUT = isAndroid ? 800 : 300
let keyboardHeight = 0
let onKeyboardShow
let focusTimer
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册