浏览代码

Bug Fix: mount() was called twice when destroy() and mount() were called manually, because of the breakpoint component.

NaotoshiFujita 4 年之前
父节点
当前提交
fa183d69e8
共有 8 个文件被更改,包括 15 次插入8 次删除
  1. 4 2
      dist/js/splide.esm.js
  2. 4 2
      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 1
      src/js/components/elements/index.js
  8. 3 0
      src/js/splide.js

+ 4 - 2
dist/js/splide.esm.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 2.4.8
+ * Version  : 2.4.9
  * License  : MIT
  * Copyright: 2020 Naotoshi Fujita
  */
@@ -1583,6 +1583,8 @@ var splide_Splide = /*#__PURE__*/function () {
       Transition = this._t;
     }
 
+    // Reset the state.
+    this.State.set(CREATED);
     this._e = Extensions;
     this._t = Transition;
     this.Components = compose(this, merge(this._c, Extensions), Transition);
@@ -2262,7 +2264,6 @@ var UID_NAME = 'uid';
     mount: function mount() {
       var _this = this;
 
-      collect();
       this.init();
       Splide.on('refresh', function () {
         _this.destroy();
@@ -2289,6 +2290,7 @@ var UID_NAME = 'uid';
      * Initialization.
      */
     init: function init() {
+      collect();
       addClass(root, getClasses());
       Elements.slides.forEach(function (slide, index) {
         Elements.register(slide, index, -1);

+ 4 - 2
dist/js/splide.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 2.4.8
+ * Version  : 2.4.9
  * License  : MIT
  * Copyright: 2020 Naotoshi Fujita
  */
@@ -1573,6 +1573,8 @@ var splide_Splide = /*#__PURE__*/function () {
       Transition = this._t;
     }
 
+    // Reset the state.
+    this.State.set(CREATED);
     this._e = Extensions;
     this._t = Transition;
     this.Components = compose(this, merge(this._c, Extensions), Transition);
@@ -2252,7 +2254,6 @@ var UID_NAME = 'uid';
     mount: function mount() {
       var _this = this;
 
-      collect();
       this.init();
       Splide.on('refresh', function () {
         _this.destroy();
@@ -2279,6 +2280,7 @@ var UID_NAME = 'uid';
      * Initialization.
      */
     init: function init() {
+      collect();
       addClass(root, getClasses());
       Elements.slides.forEach(function (slide, index) {
         Elements.register(slide, index, -1);

文件差异内容过多而无法显示
+ 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.8",
+  "version": "2.4.9",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

+ 1 - 1
package.json

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

+ 1 - 1
src/js/components/elements/index.js

@@ -84,7 +84,6 @@ export default ( Splide, Components ) => {
 		 * Collect main elements and store them as member properties.
 		 */
 		mount() {
-			collect();
 			this.init();
 
 			Splide
@@ -110,6 +109,7 @@ export default ( Splide, Components ) => {
 		 * Initialization.
 		 */
 		init() {
+			collect();
 			addClass( root, getClasses() );
 
 			Elements.slides.forEach( ( slide, index ) => {

+ 3 - 0
src/js/splide.js

@@ -54,6 +54,9 @@ export default class Splide {
 	 * @return {Splide|undefined} - This instance or undefined if an exception occurred.
 	 */
 	mount( Extensions = this._e, Transition = this._t ) {
+		// Reset the state.
+		this.State.set( STATES.CREATED );
+
 		this._e = Extensions;
 		this._t = Transition;
 

部分文件因为文件数量过多而无法显示