修复layer.notify
parent
c7f0ef3697
commit
5788a411a1
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@bytedo/wcui",
|
"name": "@bytedo/wcui",
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "基于wc开发的一套UI库, 面向未来, 面向electron",
|
"description": "基于wc开发的一套UI库, 面向未来, 面向electron",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -48,8 +48,8 @@
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
background: rgba(255, 255, 255, 0.8);
|
background: rgba(255, 255, 255, 0.8);
|
||||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
|
||||||
transition: opacity 0.2s ease-in-out, left 0.2s ease-in-out, right 0.2s ease-in-out,
|
transition: opacity 0.2s ease-in-out, left 0.2s ease-in-out,
|
||||||
top 0.2s ease-in-out, bottom 0.2s ease-in-out;
|
right 0.2s ease-in-out, top 0.2s ease-in-out, bottom 0.2s ease-in-out;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|
||||||
&.scale {
|
&.scale {
|
||||||
|
@ -261,7 +261,8 @@ const LANGUAGES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LANGUAGES['zh-CN'] = LANGUAGES.cn
|
LANGUAGES['zh-CN'] = LANGUAGES.cn
|
||||||
const lang = LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.cn
|
const lang =
|
||||||
|
LANGUAGES[window.__ENV_LANG__ || navigator.language] || LANGUAGES.cn
|
||||||
|
|
||||||
let uniqueInstance = null // 缓存当前打开的alert/confirm/prompt类型的弹窗
|
let uniqueInstance = null // 缓存当前打开的alert/confirm/prompt类型的弹窗
|
||||||
let toastInstance = null // 缓存toast的实例
|
let toastInstance = null // 缓存toast的实例
|
||||||
|
@ -315,7 +316,10 @@ export default class Layer {
|
||||||
this.props.title = val
|
this.props.title = val
|
||||||
if (val) {
|
if (val) {
|
||||||
if (this.__TITLE__.firstElementChild) {
|
if (this.__TITLE__.firstElementChild) {
|
||||||
this.__TITLE__.insertBefore(document.createTextNode(val), this.__TITLE__.firstElementChild)
|
this.__TITLE__.insertBefore(
|
||||||
|
document.createTextNode(val),
|
||||||
|
this.__TITLE__.firstElementChild
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
this.__TITLE__.textContent = val
|
this.__TITLE__.textContent = val
|
||||||
}
|
}
|
||||||
|
@ -388,7 +392,9 @@ export default class Layer {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this._dragIns = new Drag(this.root.children[1]).by(this.__TITLE__, {
|
this._dragIns = new Drag(this.root.children[1]).by(this.__TITLE__, {
|
||||||
overflow: this.props.hasOwnProperty('overflow') ? this.props.overflow : false
|
overflow: this.props.hasOwnProperty('overflow')
|
||||||
|
? this.props.overflow
|
||||||
|
: false
|
||||||
})
|
})
|
||||||
this.removeAttribute('fixed')
|
this.removeAttribute('fixed')
|
||||||
}
|
}
|
||||||
|
@ -571,8 +577,12 @@ export default class Layer {
|
||||||
this.root.children[1].style.cssText += _style
|
this.root.children[1].style.cssText += _style
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自动聚焦最后一个按钮
|
// 不是prompt类型, 在有按钮时, 自动聚焦最后一个按钮
|
||||||
if (this.props.btns.length) {
|
if (
|
||||||
|
this.props.type !== 'prompt' &&
|
||||||
|
this.props.btns.length &&
|
||||||
|
this.__CTRL__.lastElementChild
|
||||||
|
) {
|
||||||
// 部分浏览器需要执行一下 focus()才能聚焦成功
|
// 部分浏览器需要执行一下 focus()才能聚焦成功
|
||||||
this.__CTRL__.lastElementChild.setAttribute('autofocus', '')
|
this.__CTRL__.lastElementChild.setAttribute('autofocus', '')
|
||||||
setTimeout(_ => this.__CTRL__.lastElementChild.focus(), 10)
|
setTimeout(_ => this.__CTRL__.lastElementChild.focus(), 10)
|
||||||
|
|
Reference in New Issue