@dolphinweex/weex-vue-render 0.2.50 → 0.2.52

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.
@@ -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')|| appendStr.startsWith('data:image')) {
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
 
@@ -8708,6 +8748,7 @@ var slideMixin = {
8708
8748
  },
8709
8749
 
8710
8750
  _handleTouchEnd: function _handleTouchEnd (event) {
8751
+ this._startAutoPlay();
8711
8752
  // weex.weexSliderTouchBoundary = false
8712
8753
  // weex.weexSliderTouchStart = false
8713
8754
  var inner = this.$refs.inner;
@@ -8718,7 +8759,6 @@ var slideMixin = {
8718
8759
  return;
8719
8760
  }
8720
8761
 
8721
- this._startAutoPlay();
8722
8762
  var tp = this._touchParams;
8723
8763
  if (!tp) { return }
8724
8764
  var isV = tp.isVertical;
@@ -9089,7 +9129,7 @@ var indicator$1 = {
9089
9129
  }
9090
9130
  };
9091
9131
 
9092
- __$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);
9093
9133
 
9094
9134
  /*
9095
9135
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -10638,9 +10678,13 @@ function transitionOnce (vnode, config, callback) {
10638
10678
  if (config.styles["transform"]) {
10639
10679
  config.styles["transform"] = config.styles["transform"].replace(/(translate\([^,]+,[^,]+),[^)]+\)/, '$1)')
10640
10680
  }
10681
+ var toCss = toCSSText(styleObject2rem(config.styles, DESIGN_ROOT_VALUE) || {})
10682
+
10683
+ // 给dom上标记是动画修改的style
10684
+ if(!dom.animation_style) { dom.animation_style = "" }
10685
+ dom.animation_style += toCss
10641
10686
 
10642
- dom.style.cssText
10643
- += toCSSText(styleObject2rem(config.styles, DESIGN_ROOT_VALUE) || {});
10687
+ dom.style.cssText += toCss;
10644
10688
  });
10645
10689
  }
10646
10690
 
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.50"
52
+ "version": "0.2.52"
53
53
  }