瀏覽代碼

Bug Fix: add() and remove() didn't work correctly in loop mode(#145).

NaotoshiFujita 4 年之前
父節點
當前提交
55782b60b2
共有 8 個文件被更改,包括 15 次插入10 次删除
  1. 5 3
      dist/js/splide.esm.js
  2. 5 3
      dist/js/splide.js
  3. 1 1
      dist/js/splide.min.js
  4. 二進制
      dist/js/splide.min.js.gz
  5. 1 1
      package-lock.json
  6. 1 1
      package.json
  7. 1 0
      src/js/components/clones/index.js
  8. 1 1
      src/js/splide.js

+ 5 - 3
dist/js/splide.esm.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 2.4.17
+ * Version  : 2.4.18
  * License  : MIT
  * Copyright: 2020 Naotoshi Fujita
  */
@@ -1684,7 +1684,7 @@ var Splide = /*#__PURE__*/function () {
   ;
 
   _proto.refresh = function refresh() {
-    this.emit('refresh').emit('resize');
+    this.emit('refresh:before').emit('refresh').emit('resize');
     return this;
   }
   /**
@@ -3097,7 +3097,9 @@ var abs = Math.abs;
 
       if (Splide.is(LOOP)) {
         init();
-        Splide.on('refresh', init).on('resize', function () {
+        Splide.on('refresh:before', function () {
+          _this.destroy();
+        }).on('refresh', init).on('resize', function () {
           if (cloneCount !== getCloneCount()) {
             // Destroy before refresh not to collect clones by the Elements component.
             _this.destroy();

+ 5 - 3
dist/js/splide.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 2.4.17
+ * Version  : 2.4.18
  * License  : MIT
  * Copyright: 2020 Naotoshi Fujita
  */
@@ -1697,7 +1697,7 @@ var Splide = /*#__PURE__*/function () {
   ;
 
   _proto.refresh = function refresh() {
-    this.emit('refresh').emit('resize');
+    this.emit('refresh:before').emit('refresh').emit('resize');
     return this;
   }
   /**
@@ -3110,7 +3110,9 @@ var abs = Math.abs;
 
       if (Splide.is(LOOP)) {
         init();
-        Splide.on('refresh', init).on('resize', function () {
+        Splide.on('refresh:before', function () {
+          _this.destroy();
+        }).on('refresh', init).on('resize', function () {
           if (cloneCount !== getCloneCount()) {
             // Destroy before refresh not to collect clones by the Elements component.
             _this.destroy();

文件差異過大導致無法顯示
+ 1 - 1
dist/js/splide.min.js


二進制
dist/js/splide.min.js.gz


+ 1 - 1
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@splidejs/splide",
-  "version": "2.4.17",
+  "version": "2.4.18",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@splidejs/splide",
-  "version": "2.4.17",
+  "version": "2.4.18",
   "description": "Splide is a lightweight and powerful slider/carousel without any dependencies.",
   "author": "Naotoshi Fujita",
   "license": "MIT",

+ 1 - 0
src/js/components/clones/index.js

@@ -55,6 +55,7 @@ export default ( Splide, Components ) => {
 				init();
 
 				Splide
+					.on( 'refresh:before', () => { this.destroy() } )
 					.on( 'refresh', init )
 					.on( 'resize', () => {
 						if ( cloneCount !== getCloneCount() ) {

+ 1 - 1
src/js/splide.js

@@ -200,7 +200,7 @@ export default class Splide {
 	 * Destroy all Slide objects and clones and recreate them again.
 	 */
 	refresh() {
-		this.emit( 'refresh' ).emit( 'resize' );
+		this.emit( 'refresh:before' ).emit( 'refresh' ).emit( 'resize' );
 		return this;
 	}
 

部分文件因文件數量過多而無法顯示