diff --git a/CHANGELOG.md b/CHANGELOG.md index 3815c8c..7503443 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ ## 更新日志 +### 1.0.5 + +*2019-10-10* + +#### Bug fixes + +- 修复本地搜索模式下多次重复触发过滤方法, 优化搜索性能 +- 修复选项过多时, 可以使用鼠标进行横向滚动 + + ### 1.0.4 *2019-09-27* diff --git a/dist/static/2.js b/dist/static/2.js index 2854689..d21ff6b 100644 --- a/dist/static/2.js +++ b/dist/static/2.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{361:function(e,t,n){e.exports=n.p+"static/wx.f391ad4.jpg"},363:function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("section",{staticClass:"content element-doc"},[e._m(0),e._m(1),n("demo-block",[n("div",[n("p",[e._v("目前仅支持"),n("code",[e._v("中文")]),e._v("和"),n("code",[e._v("英文")]),e._v(", 如需更多语言, 可以"),n("code",[e._v("clone")]),e._v("代码进行二次开发")])]),n("template",{slot:"source"},[n("element-demo0")],1),n("template",{slot:"highlight"},[n("pre",{pre:!0},[n("code",{pre:!0,attrs:{class:"html"}},[e._v("
\n\n\n +``` +::: diff --git a/docs/router.js b/docs/router.js index 6bff649..35aa18e 100644 --- a/docs/router.js +++ b/docs/router.js @@ -75,6 +75,7 @@ export default [{ { path: '/example-custom/ZM01', name: '赋值与取值', component: importMd('/ZM01') }, { path: '/example-custom/ZM02', name: '表单提交', component: importMd('/ZM02') }, // { path: '/example-custom/ZM03', name: '表格中多选', component: importMd('/ZM03') }, + // { path: '/example-custom/ZTEST', name: '测试', component: importMd('/ZTEST') }, ] }, { path: '/question', diff --git a/package.json b/package.json index ac8c3c6..9da570e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xm-select", - "version": "1.0.4", + "version": "1.0.5", "description": "始于Layui的select多选解决方案", "main": "index.js", "scripts": { diff --git a/src/components/element/label.js b/src/components/element/label.js index 80a78f2..649392a 100644 --- a/src/components/element/label.js +++ b/src/components/element/label.js @@ -15,6 +15,32 @@ class Label extends Component{ e.stopPropagation(); } + scrollFunc(e){ + if(e.wheelDeltaX == 0){ + let child = this.labelRef.getElementsByClassName('xm-label-block'); + let sum = 10; + for(let i = 0; i < child.length; i++){ + sum += child[i].getBoundingClientRect().width + 5; + } + let width = this.labelRef.getBoundingClientRect().width; + let max = sum > width ? sum - width : width; + let left = this.labelRef.scrollLeft + e.deltaY; + left < 0 && (left = 0); + left > max && (left = max); + this.labelRef.scrollLeft = left; + } + } + + componentDidMount(){ + if (this.labelRef.addEventListener) { + this.labelRef.addEventListener('DOMMouseScroll', this.scrollFunc.bind(this), false); + } + if(this.labelRef.attachEvent){ + this.labelRef.attachEvent('onmousewheel', this.scrollFunc.bind(this)); + } + this.labelRef.onmousewheel = this.scrollFunc.bind(this); + } + render({ data, prop, theme, model, sels }) { //获取变换属性 const { name, disabled } = prop; @@ -69,7 +95,7 @@ class Label extends Component{ return (