This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化layer组件的销毁逻辑;修复路由可能会触发2次的bug;优化日期组件的回调

old
宇天 2019-05-08 11:05:05 +08:00
parent 61987f982f
commit a05bdaea41
6 changed files with 23 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "doui-anot", "name": "doui-anot",
"version": "2.0.0", "version": "2.0.1",
"description": "基于Anot框架的doUI组件库。支持IE10+,及现代浏览器。", "description": "基于Anot框架的doUI组件库。支持IE10+,及现代浏览器。",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -16,6 +16,7 @@
"license": "MIT", "license": "MIT",
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"anot": "^2.0.0",
"autoprefixer": "^7.2.6", "autoprefixer": "^7.2.6",
"babel-core": "^6.26.3", "babel-core": "^6.26.3",
"babel-plugin-transform-decorators-legacy": "^1.3.5", "babel-plugin-transform-decorators-legacy": "^1.3.5",
@ -26,9 +27,8 @@
"chalk": "^2.4.1", "chalk": "^2.4.1",
"chokidar": "^1.7.0", "chokidar": "^1.7.0",
"iofs": "^1.1.0", "iofs": "^1.1.0",
"node-sass": "^4.9.0", "node-sass": "^4.11.0",
"postcss": "^6.0.22", "postcss": "^6.0.22",
"uglify-es": "^3.3.9", "uglify-es": "^3.3.9"
"anot": "^2.0.0"
} }
} }

View File

@ -29,7 +29,7 @@
.icon {position:absolute;right:0;top:0;width:35px;text-align:center;font-size:25px;color:nth($cp, 3); .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:""} &::before {position:absolute;left:0;top:0;z-index:-1;width:100%;height:85px;background:nth($ct, 2);content:""}

View File

@ -308,7 +308,7 @@ export default Anot.component('datepicker', {
size: 'mini', //默认规格,mini, medium, large size: 'mini', //默认规格,mini, medium, large
format: '', // 日期显示格式 format: '', // 日期显示格式
created: Anot.PropsTypes.isFunction(), created: Anot.PropsTypes.isFunction(),
onDatePicked: Anot.PropsTypes.isFunction() datePicked: Anot.PropsTypes.isFunction()
}, },
skip: ['max', 'min', 'last', 'timer'], skip: ['max', 'min', 'last', 'timer'],
watch: { watch: {
@ -448,10 +448,10 @@ export default Anot.component('datepicker', {
this.close() this.close()
if ( if (
this.calendar.day > 0 && this.calendar.day > 0 &&
typeof this.props.onDatePicked === 'function' typeof this.props.datePicked === 'function'
) { ) {
// 返回一个格式化后的值和一个Date对象 // 返回一个格式化后的值和一个Date对象
this.props.onDatePicked(this.value, this.last.pick) this.props.datePicked(this.value, this.last.pick, this.$elem)
} }
} }
} }

View File

@ -81,17 +81,19 @@ const close = function(id) {
} catch (err) {} } catch (err) {}
} else { } else {
unique = null unique = null
try { if (layerDom[id]) {
layerDom[id][0].classList.add('shift') layerDom[id][0].classList.add('shift')
layerDom[id][1].classList.add('shift') layerDom[id][1].classList.add('shift')
layerDom[id][0].style.opacity = '' layerDom[id][0].style.opacity = ''
layerDom[id][1].style.opacity = 0 layerDom[id][1].style.opacity = 0
setTimeout(function() { setTimeout(function() {
layerDom[id][0].parentNode.removeChild(layerDom[id][0]) try {
delete layerDom[id] layerDom[id][0].parentNode.removeChild(layerDom[id][0])
delete Anot.vmodels[id] delete layerDom[id]
delete Anot.vmodels[id]
} catch (err) {}
}, 200) }, 200)
} catch (err) {} }
} }
document.body.style.overflow = '' document.body.style.overflow = ''
} }

View File

@ -7,7 +7,6 @@
'use strict' 'use strict'
import Format from './lib/format' import Format from './lib/format'
import format from './lib/format'
// 本地协议/头 判断正则 // 本地协议/头 判断正则
const rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/ const rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/

View File

@ -36,6 +36,7 @@ class Router {
Anot.hideProperty(this, 'table', []) Anot.hideProperty(this, 'table', [])
Anot.hideProperty(this, 'last', '') Anot.hideProperty(this, 'last', '')
Anot.hideProperty(this, 'path', '') Anot.hideProperty(this, 'path', '')
Anot.hideProperty(this, 'ready', false)
Anot.hideProperty(this, 'noMatch', null) Anot.hideProperty(this, 'noMatch', null)
Anot.hideProperty( Anot.hideProperty(
this, this,
@ -60,6 +61,13 @@ class Router {
let { mode, prefix } = this.options let { mode, prefix } = this.options
Anot.bind(window, 'load, popstate', ev => { 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 let path = mode === 'hash' ? location.hash : location.pathname
path = path.replace(prefix, '').trim() path = path.replace(prefix, '').trim()