提交 27c8c074 编写于 作者: Q qiang

Merge branch 'dev' into 0.7.0

# Conflicts:
#	packages/uni-h5/package.json
......@@ -90,6 +90,10 @@ export const showLoading = {
visible: {
type: Boolean,
default: true
},
isShowLoading: {
type: Boolean,
default: true
}
}
......
......@@ -27,7 +27,7 @@ export function showLoading (args) {
}
export function hideLoading () {
emit('onHideToast')
emit('onHideLoading')
return {}
}
......
......@@ -6,7 +6,7 @@ export function callAppHook (vm, hook, params) {
if (hook !== 'onError') {
console.debug(`App:${hook} have been invoked` + (params ? ` ${JSON.stringify(params)}` : ''))
}
return callHook(vm, hook, params)
return vm.__call_hook(hook, params)
}
export function callPageHook (vm, hook, params) {
......
......@@ -11,8 +11,7 @@
v-show="showTabBar"
v-bind="tabBar" />
<toast
v-bind="showToast"
@close="_onModalClose" />
v-bind="showToast"/>
<action-sheet
v-bind="showActionSheet"
@close="_onActionSheetClose" />
......
......@@ -8,14 +8,30 @@ export default {
},
created () {
UniServiceJSBridge.on('onShowToast', args => {
setTimeout(() => { // 延迟一下 show 可解决窗口打开前调用 showToast,showLoading 在 onHidePopup 之后触发
setTimeout(() => { // 延迟一下 show 可解决窗口打开前调用 showToast 在 onHidePopup 之后触发
this.showToast = args
}, 10)
})
UniServiceJSBridge.on(['onHidePopup', 'onHideToast'], args => {
setTimeout(() => { // 与 show 对应延迟10ms,避免快速调用 show,hide 导致无法关闭
this.showToast.visible = false
}, 10)
})
const createOnHide = (type) => {
return () => {
let warnMsg = ''
if (type === 'onHideToast' && this.showToast.isShowLoading) {
warnMsg = '请注意 showToast 与 hideToast 必须配对使用'
} else if (type === 'onHideLoading' && !this.showToast.isShowLoading) {
warnMsg = '请注意 showLoading 与 hideLoading 必须配对使用'
}
if (warnMsg) {
return console.warn(warnMsg)
}
setTimeout(() => { // 与 show 对应延迟10ms,避免快速调用 show,hide 导致无法关闭
this.showToast.visible = false
}, 10)
}
}
UniServiceJSBridge.on('onHidePopup', createOnHide('onHidePopup'))
UniServiceJSBridge.on('onHideToast', createOnHide('onHideToast'))
UniServiceJSBridge.on('onHideLoading', createOnHide('onHideLoading'))
}
}
......@@ -113,7 +113,7 @@ export default {
font-size: 18px;
word-wrap:break-word;
word-break:break-all;
white-space: pre;
white-space: pre-wrap;
overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
......@@ -128,7 +128,7 @@ export default {
line-height: 1.4;
word-wrap: break-word;
word-break: break-all;
white-space: pre;
white-space: pre-wrap;
color: #999999;
max-height: 400px;
overflow-y: auto;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册