优化layer组件的销毁逻辑;修复路由可能会触发2次的bug;优化日期组件的回调
parent
61987f982f
commit
a05bdaea41
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "doui-anot",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "基于Anot框架的doUI组件库。支持IE10+,及现代浏览器。",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -16,6 +16,7 @@
|
|||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"anot": "^2.0.0",
|
||||
"autoprefixer": "^7.2.6",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
||||
|
@ -26,9 +27,8 @@
|
|||
"chalk": "^2.4.1",
|
||||
"chokidar": "^1.7.0",
|
||||
"iofs": "^1.1.0",
|
||||
"node-sass": "^4.9.0",
|
||||
"node-sass": "^4.11.0",
|
||||
"postcss": "^6.0.22",
|
||||
"uglify-es": "^3.3.9",
|
||||
"anot": "^2.0.0"
|
||||
"uglify-es": "^3.3.9"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
.icon {position:absolute;right:0;top:0;width:35px;text-align:center;font-size:25px;color:nth($cp, 3);
|
||||
}
|
||||
}
|
||||
.calendar-box { position:absolute; left:0; top:100%; z-index:65534; width:267px; height:auto; min-height:60px;padding:10px;line-height:35px; border:1px solid #ddd; background:#fff; font-size:14px; color:nth($cd, 2); text-align:center; box-shadow:0 1px 5px rgba(0, 0, 0, 0.1);
|
||||
.calendar-box { position:fixed;z-index:65534; width:267px; height:auto; min-height:60px;padding:10px;line-height:35px; border:1px solid #ddd; background:#fff; font-size:14px; color:nth($cd, 2); text-align:center; box-shadow:0 1px 5px rgba(0, 0, 0, 0.1);
|
||||
|
||||
&::before {position:absolute;left:0;top:0;z-index:-1;width:100%;height:85px;background:nth($ct, 2);content:""}
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ export default Anot.component('datepicker', {
|
|||
size: 'mini', //默认规格,mini, medium, large
|
||||
format: '', // 日期显示格式
|
||||
created: Anot.PropsTypes.isFunction(),
|
||||
onDatePicked: Anot.PropsTypes.isFunction()
|
||||
datePicked: Anot.PropsTypes.isFunction()
|
||||
},
|
||||
skip: ['max', 'min', 'last', 'timer'],
|
||||
watch: {
|
||||
|
@ -448,10 +448,10 @@ export default Anot.component('datepicker', {
|
|||
this.close()
|
||||
if (
|
||||
this.calendar.day > 0 &&
|
||||
typeof this.props.onDatePicked === 'function'
|
||||
typeof this.props.datePicked === 'function'
|
||||
) {
|
||||
// 返回一个格式化后的值和一个Date对象
|
||||
this.props.onDatePicked(this.value, this.last.pick)
|
||||
this.props.datePicked(this.value, this.last.pick, this.$elem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,17 +81,19 @@ const close = function(id) {
|
|||
} catch (err) {}
|
||||
} else {
|
||||
unique = null
|
||||
try {
|
||||
if (layerDom[id]) {
|
||||
layerDom[id][0].classList.add('shift')
|
||||
layerDom[id][1].classList.add('shift')
|
||||
layerDom[id][0].style.opacity = ''
|
||||
layerDom[id][1].style.opacity = 0
|
||||
setTimeout(function() {
|
||||
try {
|
||||
layerDom[id][0].parentNode.removeChild(layerDom[id][0])
|
||||
delete layerDom[id]
|
||||
delete Anot.vmodels[id]
|
||||
}, 200)
|
||||
} catch (err) {}
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
document.body.style.overflow = ''
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
'use strict'
|
||||
import Format from './lib/format'
|
||||
import format from './lib/format'
|
||||
|
||||
// 本地协议/头 判断正则
|
||||
const rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/
|
||||
|
|
|
@ -36,6 +36,7 @@ class Router {
|
|||
Anot.hideProperty(this, 'table', [])
|
||||
Anot.hideProperty(this, 'last', '')
|
||||
Anot.hideProperty(this, 'path', '')
|
||||
Anot.hideProperty(this, 'ready', false)
|
||||
Anot.hideProperty(this, 'noMatch', null)
|
||||
Anot.hideProperty(
|
||||
this,
|
||||
|
@ -60,6 +61,13 @@ class Router {
|
|||
let { mode, prefix } = this.options
|
||||
|
||||
Anot.bind(window, 'load, popstate', ev => {
|
||||
if (ev.type === 'load') {
|
||||
if (this.ready) {
|
||||
return
|
||||
}
|
||||
this.ready = true
|
||||
}
|
||||
|
||||
let path = mode === 'hash' ? location.hash : location.pathname
|
||||
|
||||
path = path.replace(prefix, '').trim()
|
||||
|
|
Reference in New Issue