diff --git a/.npmignore b/.npmignore index 064e129..e6a0371 100644 --- a/.npmignore +++ b/.npmignore @@ -1,8 +1,8 @@ -/examples -/examples-src +/website/* /LICENSE -/README.md +/tests/* /.babelrc +/karma.conf.js /.idea /node_modules /build diff --git a/dist/vue-seamless-scroll.js b/dist/vue-seamless-scroll.js index d1a6e0b..d9253b7 100644 --- a/dist/vue-seamless-scroll.js +++ b/dist/vue-seamless-scroll.js @@ -216,6 +216,10 @@ exports.default = { } }, methods: { + reset: function reset() { + this._cancle(); + this._initMove(); + }, leftSwitchClick: function leftSwitchClick() { if (!this.leftSwitchState) return; @@ -437,14 +441,12 @@ exports.default = { this._dataWarm(newData); if (!arrayEqual(newData, oldData)) { - this._cancle(); - this._initMove(); + this.reset(); } }, autoPlay: function autoPlay(bol) { if (bol) { - this._cancle(); - this._initMove(); + this.reset(); } else { this._stopMove(); } diff --git a/dist/vue-seamless-scroll.min.js b/dist/vue-seamless-scroll.min.js index 332a778..e25cb4f 100644 --- a/dist/vue-seamless-scroll.min.js +++ b/dist/vue-seamless-scroll.min.js @@ -1 +1 @@ -!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.vueSeamlessScroll=i():t.vueSeamlessScroll=i()}("undefined"!=typeof self?self:this,function(){return function(t){function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}var e={};return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},i.p="",i(i.s=1)}([function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),e(4)();var o=e(5),n=e(6);i.default={name:"vue-seamless-scroll",data:function(){return{xPos:0,yPos:0,delay:0,copyHtml:"",height:0,width:0,realBoxWidth:0}},props:{data:{type:Array,default:function(){return[]}},classOption:{type:Object,default:function(){return{}}}},computed:{leftSwitchState:function(){return this.xPos<0},rightSwitchState:function(){return Math.abs(this.xPos)=this.options.limitMoveNum},hoverStopSwitch:function(){return this.options.hoverStop&&this.autoPlay&&this.scrollSwitch},canTouchScroll:function(){return this.options.openTouch},isHorizontal:function(){return this.options.direction>1},baseFontSize:function(){return this.options.isSingleRemUnit?parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1},realSingleStopWidth:function(){return this.options.singleWidth*this.baseFontSize},realSingleStopHeight:function(){return this.options.singleHeight*this.baseFontSize},step:function(){var t=this.options.step;return this.isHorizontal?this.realSingleStopWidth:this.realSingleStopHeight,t}},methods:{leftSwitchClick:function(){if(this.leftSwitchState)return Math.abs(this.xPos)1||t.scale&&1!==t.scale)){var i=t.targetTouches[0],e=this.options.direction;this.endPos={x:i.pageX-this.startPos.x,y:i.pageY-this.startPos.y},event.preventDefault();var o=Math.abs(this.endPos.x)1&&(this.xPos=this.startPosX+this.endPos.x)}},touchEnd:function(){var t=this;if(this.canTouchScroll){var i=void 0,e=this.options.direction;if(this.delay=50,1===e)this.yPos>0&&(this.yPos=0);else if(0===e){var o=this.realBoxHeight/2*-1;this.yPos0&&(this.xPos=0);else if(3===e){var n=-1*this.realBoxWidth;this.xPos=i&&(this.$emit("ScrollEnd"),this.yPos=0),this.yPos-=r):0===n?(this.yPos>=0&&(this.$emit("ScrollEnd"),this.yPos=-1*i),this.yPos+=r):2===n?(Math.abs(this.xPos)>=e&&(this.$emit("ScrollEnd"),this.xPos=0),this.xPos-=r):3===n&&(this.xPos>=0&&(this.$emit("ScrollEnd"),this.xPos=-1*e),this.xPos+=r),this.singleWaitTime&&clearTimeout(this.singleWaitTime),this.realSingleStopHeight?Math.abs(this.yPos)%this.realSingleStopHeight1&&void 0!==arguments[1]?arguments[1]:{};t.component(i.componentName||n.default.name,n.default)},"undefined"!=typeof window&&window.Vue&&Vue.component(n.default.name,n.default),i.default=n.default},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=e(0),n=e.n(o);for(var s in o)"default"!==s&&function(t){e.d(i,t,function(){return o[t]})}(s);var r=e(7),a=e(3),h=a(n.a,r.a,!1,null,null,null);i.default=h.exports},function(t,i){t.exports=function(t,i,e,o,n,s){var r,a=t=t||{},h=typeof t.default;"object"!==h&&"function"!==h||(r=t,a=t.default);var l="function"==typeof a?a.options:a;i&&(l.render=i.render,l.staticRenderFns=i.staticRenderFns,l._compiled=!0),e&&(l.functional=!0),n&&(l._scopeId=n);var c;if(s?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},l._ssrRegister=c):o&&(c=o),c){var u=l.functional,f=u?l.render:l.beforeCreate;u?(l._injectStyles=c,l.render=function(t,i){return c.call(i),f(t,i)}):l.beforeCreate=f?[].concat(f,c):[c]}return{esModule:r,exports:a,options:l}}},function(t,i){var e=function(){window.cancelAnimationFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t)}}(),window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}()};t.exports=e},function(t,i){var e=function(t,i){if(t===i)return!0;if(t.length!==i.length)return!1;for(var e=0;e=this.options.limitMoveNum},hoverStopSwitch:function(){return this.options.hoverStop&&this.autoPlay&&this.scrollSwitch},canTouchScroll:function(){return this.options.openTouch},isHorizontal:function(){return this.options.direction>1},baseFontSize:function(){return this.options.isSingleRemUnit?parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1},realSingleStopWidth:function(){return this.options.singleWidth*this.baseFontSize},realSingleStopHeight:function(){return this.options.singleHeight*this.baseFontSize},step:function(){var t=this.options.step;return this.isHorizontal?this.realSingleStopWidth:this.realSingleStopHeight,t}},methods:{reset:function(){this._cancle(),this._initMove()},leftSwitchClick:function(){if(this.leftSwitchState)return Math.abs(this.xPos)1||t.scale&&1!==t.scale)){var i=t.targetTouches[0],e=this.options.direction;this.endPos={x:i.pageX-this.startPos.x,y:i.pageY-this.startPos.y},event.preventDefault();var o=Math.abs(this.endPos.x)1&&(this.xPos=this.startPosX+this.endPos.x)}},touchEnd:function(){var t=this;if(this.canTouchScroll){var i=void 0,e=this.options.direction;if(this.delay=50,1===e)this.yPos>0&&(this.yPos=0);else if(0===e){var o=this.realBoxHeight/2*-1;this.yPos0&&(this.xPos=0);else if(3===e){var n=-1*this.realBoxWidth;this.xPos=i&&(this.$emit("ScrollEnd"),this.yPos=0),this.yPos-=r):0===n?(this.yPos>=0&&(this.$emit("ScrollEnd"),this.yPos=-1*i),this.yPos+=r):2===n?(Math.abs(this.xPos)>=e&&(this.$emit("ScrollEnd"),this.xPos=0),this.xPos-=r):3===n&&(this.xPos>=0&&(this.$emit("ScrollEnd"),this.xPos=-1*e),this.xPos+=r),this.singleWaitTime&&clearTimeout(this.singleWaitTime),this.realSingleStopHeight?Math.abs(this.yPos)%this.realSingleStopHeight1&&void 0!==arguments[1]?arguments[1]:{};t.component(i.componentName||n.default.name,n.default)},"undefined"!=typeof window&&window.Vue&&Vue.component(n.default.name,n.default),i.default=n.default},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var o=e(0),n=e.n(o);for(var s in o)"default"!==s&&function(t){e.d(i,t,function(){return o[t]})}(s);var r=e(7),a=e(3),h=a(n.a,r.a,!1,null,null,null);i.default=h.exports},function(t,i){t.exports=function(t,i,e,o,n,s){var r,a=t=t||{},h=typeof t.default;"object"!==h&&"function"!==h||(r=t,a=t.default);var l="function"==typeof a?a.options:a;i&&(l.render=i.render,l.staticRenderFns=i.staticRenderFns,l._compiled=!0),e&&(l.functional=!0),n&&(l._scopeId=n);var c;if(s?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},l._ssrRegister=c):o&&(c=o),c){var u=l.functional,f=u?l.render:l.beforeCreate;u?(l._injectStyles=c,l.render=function(t,i){return c.call(i),f(t,i)}):l.beforeCreate=f?[].concat(f,c):[c]}return{esModule:r,exports:a,options:l}}},function(t,i){var e=function(){window.cancelAnimationFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t)}}(),window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}()};t.exports=e},function(t,i){var e=function(t,i){if(t===i)return!0;if(t.length!==i.length)return!1;for(var e=0;e
-
+
-
+
+ +
    +
  • +
+
+ + + + + diff --git a/website/docs/.vuepress/components/Example10Basic.vue b/website/docs/.vuepress/components/Example10Basic.vue new file mode 100644 index 0000000..482a633 --- /dev/null +++ b/website/docs/.vuepress/components/Example10Basic.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/website/docs/.vuepress/components/Example11Basic.vue b/website/docs/.vuepress/components/Example11Basic.vue new file mode 100644 index 0000000..e9f9326 --- /dev/null +++ b/website/docs/.vuepress/components/Example11Basic.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/website/docs/.vuepress/config.js b/website/docs/.vuepress/config.js index d287e1e..8fc80c9 100644 --- a/website/docs/.vuepress/config.js +++ b/website/docs/.vuepress/config.js @@ -63,6 +63,9 @@ module.exports = { "06-singleStop", "07-singleStopTime", "08-switch", + "09-echart", + "10-array-property-update", + "11-array-length-update", ], }, ], @@ -115,6 +118,9 @@ module.exports = { "06-singleStop", "07-singleStopTime", "08-switch", + "09-echart", + "10-array-property-update", + "11-array-length-update", ], }, ], diff --git a/website/docs/changelog/README.md b/website/docs/changelog/README.md index 0bcbacb..c604d67 100644 --- a/website/docs/changelog/README.md +++ b/website/docs/changelog/README.md @@ -3,11 +3,13 @@ sidebar: auto --- # Changelog -## 1.1.21 (2020-04-05) +## 1.1.23 (2020-12-06) -* fixed issues: [#68](https://github.com/chenxuan0000/vue-seamless-scroll/issues/68) [#87](https://github.com/chenxuan0000/vue-seamless-scroll/issues/87) [#89](https://github.com/chenxuan0000/vue-seamless-scroll/issues/89) +* fixed issues: [#138](https://github.com/chenxuan0000/vue-seamless-scroll/issues/138) [#136](https://github.com/chenxuan0000/vue-seamless-scroll/issues/136) [#127](https://github.com/chenxuan0000/vue-seamless-scroll/issues/127) +## 1.1.21 (2020-04-05) +* fixed issues: [#68](https://github.com/chenxuan0000/vue-seamless-scroll/issues/68) [#87](https://github.com/chenxuan0000/vue-seamless-scroll/issues/87) [#89](https://github.com/chenxuan0000/vue-seamless-scroll/issues/89) ## 1.1.20 (2020-04-05) diff --git a/website/docs/guide/09-echart.md b/website/docs/guide/09-echart.md new file mode 100644 index 0000000..017aeab --- /dev/null +++ b/website/docs/guide/09-echart.md @@ -0,0 +1,118 @@ +# 09 - echart图表无缝滚动 + + + + + +```vue + + + + + + +``` + diff --git a/website/docs/guide/10-array-property-update.md b/website/docs/guide/10-array-property-update.md new file mode 100644 index 0000000..84bb965 --- /dev/null +++ b/website/docs/guide/10-array-property-update.md @@ -0,0 +1,109 @@ +# 10 - 复杂结构数组属性更新问题 + + + + + +```vue + + + + + + +``` + diff --git a/website/docs/guide/11-array-length-update.md b/website/docs/guide/11-array-length-update.md new file mode 100644 index 0000000..cf31380 --- /dev/null +++ b/website/docs/guide/11-array-length-update.md @@ -0,0 +1,109 @@ +# 11 - 滚动列表动态追加数据 + + + + + +```vue + + + + + + +``` + diff --git a/website/docs/zh/changelog/README.md b/website/docs/zh/changelog/README.md index 0351bb2..7321269 100644 --- a/website/docs/zh/changelog/README.md +++ b/website/docs/zh/changelog/README.md @@ -3,17 +3,18 @@ sidebar: auto --- # 更新日志 +## 1.1.23 (2020-12-06) + +* fixed issues: [#138](https://github.com/chenxuan0000/vue-seamless-scroll/issues/138) [#136](https://github.com/chenxuan0000/vue-seamless-scroll/issues/136) [#127](https://github.com/chenxuan0000/vue-seamless-scroll/issues/127) ## 1.1.21 (2020-04-05) * fixed issues: [#68](https://github.com/chenxuan0000/vue-seamless-scroll/issues/68) [#87](https://github.com/chenxuan0000/vue-seamless-scroll/issues/87) [#89](https://github.com/chenxuan0000/vue-seamless-scroll/issues/89) - ## 1.1.20 (2020-04-05) * 文档更新,源码微调 - ## 1.1.17 (2019-07-29) * fixed: step属性设置为1以下的小数点,向上滚动有卡顿的晃动。 diff --git a/website/docs/zh/guide/09-echart.md b/website/docs/zh/guide/09-echart.md new file mode 100644 index 0000000..017aeab --- /dev/null +++ b/website/docs/zh/guide/09-echart.md @@ -0,0 +1,118 @@ +# 09 - echart图表无缝滚动 + + + + + +```vue + + + + + + +``` + diff --git a/website/docs/zh/guide/10-array-property-update.md b/website/docs/zh/guide/10-array-property-update.md new file mode 100644 index 0000000..84bb965 --- /dev/null +++ b/website/docs/zh/guide/10-array-property-update.md @@ -0,0 +1,109 @@ +# 10 - 复杂结构数组属性更新问题 + + + + + +```vue + + + + + + +``` + diff --git a/website/docs/zh/guide/11-array-length-update.md b/website/docs/zh/guide/11-array-length-update.md new file mode 100644 index 0000000..cf31380 --- /dev/null +++ b/website/docs/zh/guide/11-array-length-update.md @@ -0,0 +1,109 @@ +# 11 - 滚动列表动态追加数据 + + + + + +```vue + + + + + + +``` + diff --git a/website/package.json b/website/package.json index 4464419..03e2210 100644 --- a/website/package.json +++ b/website/package.json @@ -6,15 +6,17 @@ "license": "MIT", "private": false, "scripts": { - "docs:dev": "vuepress dev docs", - "docs:build": "vuepress build docs", + "docs:dev": "sudo vuepress dev docs", + "docs:build": "sudo vuepress build docs", "docs:deploy": "sudo ./deploy.sh" }, - "dependencies": {}, + "dependencies": { + "echarts": "^4.0.0", + "vue-seamless-scroll": "^1.1.21" + }, "devDependencies": { "@vuepress/plugin-back-to-top": "^1.6.0", "@vuepress/plugin-google-analytics": "^1.6.0", - "vue-seamless-scroll": "^1.1.21", "vuepress-plugin-seo": "^0.1.4", "vuepress-plugin-sitemap": "^2.3.1", "vuepress": "^1.7.1", diff --git a/website/public b/website/public new file mode 160000 index 0000000..c3970aa --- /dev/null +++ b/website/public @@ -0,0 +1 @@ +Subproject commit c3970aaeb0df10c8d4cececa73059fe164a3c6b1