提交 ccc71a43 编写于 作者: fxy060608's avatar fxy060608

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

......@@ -90,10 +90,6 @@ export const showLoading = {
visible: {
type: Boolean,
default: true
},
isShowLoading: {
type: Boolean,
default: true
}
}
......
......@@ -22,7 +22,7 @@ export function hideToast () {
}
export function showLoading (args) {
emit('onShowToast', args)
emit('onShowLoading', args)
return {}
}
......
......@@ -7,28 +7,37 @@ export default {
}
},
created () {
UniServiceJSBridge.on('onShowToast', args => {
setTimeout(() => { // 延迟一下 show 可解决窗口打开前调用 showToast 在 onHidePopup 之后触发
this.showToast = args
}, 10)
})
let showType = ''
const createOnShow = (type) => {
return (args) => {
showType = type
setTimeout(() => { // 延迟一下 show 可解决窗口打开前调用 showToast 在 onHidePopup 之后触发
this.showToast = args
}, 10)
}
}
UniServiceJSBridge.on('onShowToast', createOnShow('onShowToast'))
UniServiceJSBridge.on('onShowLoading', createOnShow('onShowLoading'))
const createOnHide = (type) => {
return () => {
let warnMsg = ''
if (type === 'onHideToast' && this.showToast.isShowLoading) {
if (type === 'onHideToast' && showType !== 'onShowToast') {
warnMsg = '请注意 showToast 与 hideToast 必须配对使用'
} else if (type === 'onHideLoading' && !this.showToast.isShowLoading) {
} else if (type === 'onHideLoading' && showType !== 'onShowLoading') {
warnMsg = '请注意 showLoading 与 hideLoading 必须配对使用'
}
if (warnMsg) {
return console.warn(warnMsg)
}
}
showType = ''
setTimeout(() => { // 与 show 对应延迟10ms,避免快速调用 show,hide 导致无法关闭
this.showToast.visible = false
}, 10)
}
}
}
UniServiceJSBridge.on('onHidePopup', createOnHide('onHidePopup'))
UniServiceJSBridge.on('onHideToast', createOnHide('onHideToast'))
......
import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
// 不支持的 API 列表
const todos = [
'hideKeyboard',
......@@ -48,9 +48,14 @@ const protocols = {
// TODO
// data 不支持 ArrayBuffer
// method 不支持 TRACE, CONNECT
// dataType 可取值为 string/json
return {
method: 'method'
method: 'method',
dataType (type) {
return {
name: 'dataType',
value: type === 'json' ? type : 'string'
}
}
}
}
},
......@@ -96,4 +101,4 @@ export {
protocols,
todos,
canIUses
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册