bk-magic-vue 2.4.10 → 2.4.11-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48686,6 +48686,16 @@
48686
48686
  var indexMove = this.realWidth * this.currentIndex;
48687
48687
  var imageMove = indexMove - this.mouseDistance;
48688
48688
  return -imageMove;
48689
+ },
48690
+ swiperStyle: function swiperStyle() {
48691
+ var swiperStyle = {};
48692
+ if (this.realWidth > 0) {
48693
+ swiperStyle.width = "".concat(this.realWidth, "px");
48694
+ }
48695
+ if (this.realHeight > 0) {
48696
+ swiperStyle.height = "".concat(this.realHeight, "px");
48697
+ }
48698
+ return swiperStyle;
48689
48699
  }
48690
48700
  },
48691
48701
  watch: {
@@ -48704,16 +48714,21 @@
48704
48714
  }
48705
48715
  },
48706
48716
  mounted: function mounted() {
48707
- this.initStatus();
48717
+ var _this = this;
48718
+ setTimeout(function () {
48719
+ _this.initStatus();
48720
+ });
48708
48721
  },
48709
48722
  beforeDestroy: function beforeDestroy() {
48710
48723
  this.destoryStatus();
48711
48724
  },
48712
48725
  methods: {
48713
48726
  calcSize: function calcSize() {
48727
+ console.log(this);
48728
+ var swiperSize = getElementSize(this.$refs.swiper);
48714
48729
  var swiperParentSize = getElementSize(this.$refs.swiper && this.$refs.swiper.parentElement);
48715
- this.realWidth = +this.width > 0 ? this.width : swiperParentSize.width || 600;
48716
- this.realHeight = +this.height > 0 ? this.height : swiperParentSize.height || 300;
48730
+ this.realWidth = +this.width > 0 ? this.width : swiperSize.width > 0 ? swiperSize.width : swiperParentSize.width;
48731
+ this.realHeight = +this.height > 0 ? this.height : swiperSize.height > 25 ? swiperSize.height : swiperParentSize.height;
48717
48732
  },
48718
48733
  initStatus: function initStatus() {
48719
48734
  this.calcSize();
@@ -48727,13 +48742,13 @@
48727
48742
  document.removeEventListener('visibilitychange', this.visChange);
48728
48743
  },
48729
48744
  watchParentSizeChange: function watchParentSizeChange() {
48730
- var _this = this;
48745
+ var _this2 = this;
48731
48746
  var parentEle = this.$refs.swiper && this.$refs.swiper.parentElement;
48732
48747
  if (!parentEle || !window.ResizeObserver) {
48733
48748
  return;
48734
48749
  }
48735
48750
  this.resizeObserver = new ResizeObserver(function () {
48736
- _this.calcSize();
48751
+ _this2.calcSize();
48737
48752
  });
48738
48753
  this.resizeObserver.observe(parentEle);
48739
48754
  },
@@ -48800,13 +48815,13 @@
48800
48815
  }
48801
48816
  },
48802
48817
  startLoop: function startLoop() {
48803
- var _this2 = this;
48818
+ var _this3 = this;
48804
48819
  if (!this.isLoop) return;
48805
48820
  this.endLoop();
48806
48821
  this.loopId = window.setTimeout(function () {
48807
- _this2.isTransition = true;
48808
- _this2.changeCurrentIndex(_this2.currentIndex + 1);
48809
- _this2.startLoop();
48822
+ _this3.isTransition = true;
48823
+ _this3.changeCurrentIndex(_this3.currentIndex + 1);
48824
+ _this3.startLoop();
48810
48825
  }, this.loopTime);
48811
48826
  },
48812
48827
  endLoop: function endLoop() {
@@ -48829,10 +48844,7 @@
48829
48844
  return _vm.sourceList.length ? _c('section', {
48830
48845
  ref: "swiper",
48831
48846
  class: ['bk-swiper-home', _vm.extCls],
48832
- style: {
48833
- width: _vm.realWidth + "px",
48834
- height: _vm.realHeight + "px"
48835
- }
48847
+ style: _vm.swiperStyle
48836
48848
  }, [_c('hgroup', {
48837
48849
  class: [{
48838
48850
  'bk-transition': _vm.isTransition