@dolphinweex/weex-vue-render 0.2.49 → 0.2.51

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.
@@ -2919,7 +2919,7 @@ function mapFormEvents (context) {
2919
2919
  var eventMap = {};['input', 'change', 'focus', 'blur', 'return'].forEach(function (type) {
2920
2920
  eventMap[type] = function (event) {
2921
2921
  if (context.$el) {
2922
- if(context.maxlength){
2922
+ if(context.maxlength && context.value){
2923
2923
  context.value = context.value.slice(0,context.maxlength)
2924
2924
  }
2925
2925
  event.value = context.$el.value;
@@ -5616,71 +5616,105 @@ function getImage(weex) {
5616
5616
  src: String,
5617
5617
  saveImg: {
5618
5618
  type: [String],
5619
- default: ''
5619
+ default: "",
5620
+ },
5621
+ },
5622
+ watch: {
5623
+ src: function (newVal, oldVal) {
5624
+ if (newVal !== oldVal) {
5625
+ this.loadImage();
5626
+ }
5620
5627
  },
5621
5628
  },
5622
5629
  created: function created() {
5623
- this.currentSrc = this.src;
5630
+ // this.currentSrc = this.src;
5624
5631
  },
5632
+
5625
5633
  mounted: function () {
5626
- this.locationSrc = this.removeHtmlAndAfter(window.location.href)
5634
+ // this.locationSrc = this.removeHtmlAndAfter(window.location.href);
5627
5635
  },
5628
5636
  methods: {
5629
- save: function (callback) {
5637
+ loadImage: function loadImage() {
5638
+ const img = new Image();
5639
+ img.src = this.src;
5640
+ img.onload = (event) => {
5641
+ // 触发load事件并传递参数
5642
+ this.$emit("load", {
5643
+ success: true,
5644
+ size: {
5645
+ naturalWidth: img.width,
5646
+ naturalHeight: img.height,
5647
+ },
5648
+ });
5649
+ };
5650
+ img.onerror = (event) => {
5651
+ // 触发error事件并传递参数
5652
+ this.$emit("error", {
5653
+ success: false,
5654
+ });
5655
+ };
5656
+ },
5657
+ save: function save(callback) {
5630
5658
  const params = {
5631
- operation: 'saveImageToPhotosAlbum',
5659
+ operation: "saveImageToPhotosAlbum",
5632
5660
  params: {
5633
- src: this.saveImg
5634
- }
5635
- }
5636
- weex.requireModule('bridgeModule').commandInterface(JSON.stringify(params),
5661
+ src: this.saveImg,
5662
+ },
5663
+ };
5664
+ weex.requireModule("bridgeModule").commandInterface(
5665
+ JSON.stringify(params),
5637
5666
  (resData) => {
5638
- if (typeof callback === 'function') {
5667
+ if (typeof callback === "function") {
5639
5668
  callback({ success: true });
5640
5669
  }
5641
5670
  },
5642
5671
  (error) => {
5643
- if (typeof callback === 'function') {
5672
+ if (typeof callback === "function") {
5644
5673
  callback({ success: false });
5645
5674
  }
5646
5675
  }
5647
- )
5676
+ );
5648
5677
  },
5649
5678
  handleClick: function handleClick(event) {
5650
- this.$emit('weex$tap', event);
5679
+ this.$emit("weex$tap", event);
5651
5680
  },
5652
5681
  _handleTouchStart: function _handleTouchStart(event) {
5653
- if (this.saveImg) {
5654
- this.save()
5655
- }
5656
- },
5657
- removeHtmlAndAfter(url) {
5682
+ if (this.saveImg) {
5683
+ this.save();
5684
+ }
5685
+ },
5686
+ removeHtmlAndAfter(url) {
5658
5687
  const baseUrl = url.split(/[?#]/)[0];
5659
5688
  // 找到最后一个/和.html的位置
5660
- const lastSlashIndex = baseUrl.lastIndexOf('/');
5661
- const htmlIndex = baseUrl.indexOf('.html', lastSlashIndex);
5662
-
5689
+ const lastSlashIndex = baseUrl.lastIndexOf("/");
5690
+ const htmlIndex = baseUrl.indexOf(".html", lastSlashIndex);
5691
+
5663
5692
  return htmlIndex !== -1
5664
5693
  ? baseUrl.substring(0, lastSlashIndex)
5665
5694
  : baseUrl;
5666
5695
  },
5667
5696
  processAndConcatenate(baseUrl, appendStr) {
5668
- if (appendStr.startsWith('http') || appendStr.startsWith('meiju://') || appendStr.startsWith('file')) {
5669
- return appendStr
5670
- }
5671
- const path = baseUrl + '/'
5697
+ if (
5698
+ appendStr.startsWith("http") ||
5699
+ appendStr.startsWith("meiju://") ||
5700
+ appendStr.startsWith("file") ||
5701
+ appendStr.startsWith("data:image")
5702
+ ) {
5703
+ return appendStr;
5704
+ }
5705
+ const path = baseUrl + "/";
5672
5706
  if (!baseUrl && !appendStr) {
5673
- return appendStr
5707
+ return appendStr;
5674
5708
  }
5675
5709
  let processedAppendStr = appendStr;
5676
-
5677
- if (/^[a-zA-Z]/i.test(appendStr) && appendStr.includes('/')) {
5710
+
5711
+ if (/^[a-zA-Z]/i.test(appendStr) && appendStr.includes("/")) {
5678
5712
  return path + appendStr; // 直接返回绝对路径
5679
5713
  }
5680
5714
  if (processedAppendStr.startsWith("/")) {
5681
- return path + appendStr
5715
+ return path + appendStr;
5682
5716
  }
5683
-
5717
+
5684
5718
  // 去除 @、./、../
5685
5719
  if (processedAppendStr.startsWith("@")) {
5686
5720
  processedAppendStr = processedAppendStr.slice(1);
@@ -5695,34 +5729,40 @@ function getImage(weex) {
5695
5729
  processedAppendStr = processedAppendStr.slice(3);
5696
5730
  }
5697
5731
  }
5698
-
5699
-
5732
+
5700
5733
  // 查找非路径分隔符和特殊前缀的字符串起始位置
5701
5734
  let startIndex = 0;
5702
- while (startIndex < processedAppendStr.length &&
5703
- (processedAppendStr[startIndex] === '.' || processedAppendStr[startIndex] === '/')) {
5735
+ while (
5736
+ startIndex < processedAppendStr.length &&
5737
+ (processedAppendStr[startIndex] === "." ||
5738
+ processedAppendStr[startIndex] === "/")
5739
+ ) {
5704
5740
  startIndex++;
5705
5741
  }
5706
5742
  processedAppendStr = processedAppendStr.slice(startIndex);
5707
-
5743
+
5708
5744
  return path + processedAppendStr;
5709
5745
  },
5710
5746
  },
5711
5747
 
5712
- render: function render (createElement) {
5713
- return createElement('html:img', {
5748
+ render: function render(createElement) {
5749
+ return createElement("figure", {
5714
5750
  attrs: {
5715
- 'weex-type': 'img',
5716
- src: this.processAndConcatenate(this.locationSrc, this.src),
5751
+ "weex-type": "img",
5752
+ src: this.src,
5717
5753
  },
5718
5754
  on: {
5719
- 'weex$tap': this.handleClick,
5755
+ weex$tap: this.handleClick,
5720
5756
  },
5721
- staticClass: 'weex-image weex-el',
5722
- staticStyle: weex.extractComponentStyle(this)
5723
- })
5724
- }
5725
- }
5757
+ staticClass: "weex-image weex-el",
5758
+ staticStyle: {
5759
+ backgroundImage: `url(${this.src})`,
5760
+ backgroundSize: this.resize || "stretch",
5761
+ backgroundRepeat: "no-repeat",
5762
+ },
5763
+ });
5764
+ },
5765
+ };
5726
5766
  }
5727
5767
 
5728
5768
 
@@ -7743,8 +7783,8 @@ var slideMixin = {
7743
7783
  this.innerOffset = 0;
7744
7784
  this._indicator = null;
7745
7785
 
7746
- // 向上寻找nav组件(父级weex-slider)
7747
- this._findParentNav();
7786
+ // // 向上寻找nav组件(父级weex-slider)
7787
+ // this._findParentNav();
7748
7788
  },
7749
7789
 
7750
7790
  beforeUpdate: function beforeUpdate () {
@@ -8544,11 +8584,10 @@ var slideMixin = {
8544
8584
  if (!this.scrollable || this.frameCount<=1) {
8545
8585
  return // 🚫 禁止滚动行为
8546
8586
  }
8547
- console.log(weex.weexSliderTouchBoundary,'cdj----weex.weexSliderTouchBoundary')
8548
- if(weex.weexSliderTouchStart && !weex.weexSliderTouchBoundary){
8549
- return
8550
- }
8551
- weex.weexSliderTouchStart = true
8587
+ // if(weex.weexSliderTouchStart){
8588
+ // return
8589
+ // }
8590
+ // weex.weexSliderTouchStart = true
8552
8591
 
8553
8592
  this.lastMoveTime = Date.now();
8554
8593
  this.lastMovePosition = event.touches[0].pageX;
@@ -8633,8 +8672,8 @@ var slideMixin = {
8633
8672
  const atFirst = this._preIndex === 0;
8634
8673
  const atLast = this._preIndex === this.frameCount - 1;
8635
8674
  if (!this.infinite && !this.autoPlay && ((atLast && isLeftSwipe) || (atFirst && isRightSwipe)) && !weex.weexSliderTouchBoundary) {
8636
- weex.weexSliderTouchBoundary = true
8637
- this._parentNav._touchParams = ref
8675
+ // weex.weexSliderTouchBoundary = true
8676
+ // this._parentNav._touchParams = ref
8638
8677
  //如果是边界并继续滑动
8639
8678
  return
8640
8679
  }
@@ -8709,8 +8748,9 @@ var slideMixin = {
8709
8748
  },
8710
8749
 
8711
8750
  _handleTouchEnd: function _handleTouchEnd (event) {
8712
- weex.weexSliderTouchBoundary = false
8713
- weex.weexSliderTouchStart = false
8751
+ this._startAutoPlay();
8752
+ // weex.weexSliderTouchBoundary = false
8753
+ // weex.weexSliderTouchStart = false
8714
8754
  var inner = this.$refs.inner;
8715
8755
  this._refresh && this._refresh.pullingEnd();
8716
8756
  if (touchSliderInstance == inner) {
@@ -8719,7 +8759,6 @@ var slideMixin = {
8719
8759
  return;
8720
8760
  }
8721
8761
 
8722
- this._startAutoPlay();
8723
8762
  var tp = this._touchParams;
8724
8763
  if (!tp) { return }
8725
8764
  var isV = tp.isVertical;
@@ -9090,7 +9129,7 @@ var indicator$1 = {
9090
9129
  }
9091
9130
  };
9092
9131
 
9093
- __$styleInject("/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n \n.weex-slider-wrapper {\n overflow: hidden;\n}\n\n.weex-slider-inner {\n width: 100%;\n height: 100%;\n overflow: visible;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n flex-direction: row;\n}\n\n.weex-slider-cell {\n width: 100%;\n height: 100%;\n float:left;\n top: 0px;\n left: 0px;\n background: transparent !important;\n overflow: hidden;\n -webkit-box-align: center;\n -webkit-align-items: flex-start;\n align-items: flex-start;\n -webkit-box-pack: center;\n}\n\n.neighbor-cell {\n overflow: visible !important;\n}\n\nnav.weex-indicator {\n position: absolute;\n ;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n flex-direction: row;\n margin: 0;\n padding: 0;\n -webkit-box-align: center;\n -webkit-align-items: center;\n align-items: center;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n justify-content: center;\n -webkit-transform: translate(-10rem, 0px);\n transform: translate(-10rem, 0px)\n}\n\ndiv.weex-indicator-inner {\n -webkit-transform: translate(10rem, 0px);\n transform: translate(10rem, 0px);\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n flex-direction: row;\n display: flex; \n}\n\n.weex-indicator-item {\n display: inline-block;\n position: relative;\n border-radius: 50%;\n width: 0.266667rem;\n height: 0.266667rem;\n background-color: #BBBBBB;\n}\n.weex-indicator-item + .weex-indicator-item {\n margin-left: 0.133333rem;\n}\n\n.weex-indicator-item-active {\n background-color: blue;\n}",undefined);
9132
+ __$styleInject("/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n \n.weex-slider-wrapper {\n overflow: hidden;\n}\n\n.weex-slider-inner {\n width: 100%;\n height: 100%;\n overflow: visible;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n flex-direction: row;\n}\n\n.weex-slider-cell {\n width: 100%;\n height: 100%;\n float:left;\n top: 0px;\n left: 0px;\n background: transparent !important;\n overflow: hidden;\n -webkit-box-align: center;\n -webkit-align-items: flex-start;\n align-items: flex-start;\n -webkit-box-pack: center;\n}\n\n.neighbor-cell {\n overflow: visible !important;\n}\n\nnav.weex-indicator {\n z-index:10; \n position: absolute;\n ;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n flex-direction: row;\n margin: 0;\n padding: 0;\n -webkit-box-align: center;\n -webkit-align-items: center;\n align-items: center;\n -webkit-box-pack: center;\n -webkit-justify-content: center;\n justify-content: center;\n -webkit-transform: translate(-10rem, 0px);\n transform: translate(-10rem, 0px)\n}\n\ndiv.weex-indicator-inner {\n height: inherit; \n overflow: hidden;\n align-items: center; \n -webkit-transform: translate(10rem, 0px);\n transform: translate(10rem, 0px);\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -webkit-flex-direction: row;\n flex-direction: row;\n display: flex; \n}\n\n.weex-indicator-item {\n display: inline-block;\n position: relative;\n border-radius: 50%;\n width: 0.266667rem;\n height: 0.266667rem;\n background-color: #BBBBBB;\n}\n.weex-indicator-item + .weex-indicator-item {\n margin-left: 0.133333rem;\n}\n\n.weex-indicator-item-active {\n background-color: blue;\n}",undefined);
9094
9133
 
9095
9134
  /*
9096
9135
  * Licensed to the Apache Software Foundation (ASF) under one
package/package.json CHANGED
@@ -49,5 +49,5 @@
49
49
  "type": "git",
50
50
  "url": "git+ssh://git@github.com/weexteam/weex-vue-render.git"
51
51
  },
52
- "version": "0.2.49"
52
+ "version": "0.2.51"
53
53
  }