From a05bdaea413810cf8661afd2e937c10706f58de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Wed, 8 May 2019 11:05:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96layer=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E9=94=80=E6=AF=81=E9=80=BB=E8=BE=91;=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=B7=AF=E7=94=B1=E5=8F=AF=E8=83=BD=E4=BC=9A=E8=A7=A6?= =?UTF-8?q?=E5=8F=912=E6=AC=A1=E7=9A=84bug;=E4=BC=98=E5=8C=96=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E7=BB=84=E4=BB=B6=E7=9A=84=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 8 ++++---- src/css/datepicker.scss | 2 +- src/datepicker/index.js | 6 +++--- src/layer/index.js | 12 +++++++----- src/request/index.js | 1 - src/router/index.js | 8 ++++++++ 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index ae3518d..f9ae66b 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/css/datepicker.scss b/src/css/datepicker.scss index 6115b7d..39c351a 100644 --- a/src/css/datepicker.scss +++ b/src/css/datepicker.scss @@ -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:""} diff --git a/src/datepicker/index.js b/src/datepicker/index.js index 2f26a1c..2c862ed 100644 --- a/src/datepicker/index.js +++ b/src/datepicker/index.js @@ -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) } } } diff --git a/src/layer/index.js b/src/layer/index.js index 6fd9bda..f04f58c 100644 --- a/src/layer/index.js +++ b/src/layer/index.js @@ -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() { - layerDom[id][0].parentNode.removeChild(layerDom[id][0]) - delete layerDom[id] - delete Anot.vmodels[id] + try { + layerDom[id][0].parentNode.removeChild(layerDom[id][0]) + delete layerDom[id] + delete Anot.vmodels[id] + } catch (err) {} }, 200) - } catch (err) {} + } } document.body.style.overflow = '' } diff --git a/src/request/index.js b/src/request/index.js index 921f473..eb64ad6 100644 --- a/src/request/index.js +++ b/src/request/index.js @@ -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):$/ diff --git a/src/router/index.js b/src/router/index.js index 22c1134..b14aa56 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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()