@taole/dev-helper 0.0.30 → 0.0.31

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.
@@ -60,6 +60,10 @@
60
60
  console.log('open-diandian: wx-open-launch-app appended');
61
61
  // 监听打开app失败的情况,跳转fallback链接
62
62
  this._openAppTag.addEventListener('error', (e) => {
63
+ if (this._isHarmony) {
64
+ this._showOpenInBrowserHint();
65
+ return;
66
+ }
63
67
  var tmplnk = document.createElement("a");
64
68
  tmplnk.href = this._alink_fallback;
65
69
  tmplnk.click();
@@ -80,6 +84,10 @@
80
84
  this.shadowRoot.appendChild(this._template.content);
81
85
  this._alink.addEventListener('click', this._handleAlinkClick.bind(this));
82
86
  console.log('open-diandian: open link appended');
87
+ // only test
88
+ // if(this._isHarmony){
89
+ // this._showOpenInBrowserHint();
90
+ // }
83
91
  }
84
92
  this._updateTagAttr();
85
93
  }
@@ -101,6 +109,34 @@
101
109
  this._alink = null;
102
110
  }
103
111
  }
112
+ _showOpenInBrowserHint() { // 提示用户在浏览器中打开
113
+ console.log('open-diandian: showOpenInBrowserHint');
114
+ let _hHintDiv = document.getElementById('open-diandian-h-hint-div');
115
+ if(_hHintDiv){
116
+ _hHintDiv.remove();
117
+ _hHintDiv = null;
118
+ }
119
+ // https://asset.tuwan.com/images/llqdk.png
120
+ _hHintDiv = document.createElement('div');
121
+ _hHintDiv.id = 'open-diandian-h-hint-div';
122
+ _hHintDiv.style.position = 'fixed';
123
+ _hHintDiv.style.top = '0';
124
+ _hHintDiv.style.left = '0';
125
+ _hHintDiv.style.width = '100%';
126
+ _hHintDiv.style.height = '100%';
127
+ _hHintDiv.style.zIndex = '100000';
128
+ _hHintDiv.style.backgroundImage = 'url(https://asset.tuwan.com/images/llqdk.png)';
129
+ _hHintDiv.style.backgroundRepeat = 'no-repeat';
130
+ _hHintDiv.style.backgroundSize = '80vw auto';
131
+ _hHintDiv.style.backgroundPosition = 'top right';
132
+ _hHintDiv.style.backgroundColor = 'rgba(0,0,0,0.5)';
133
+ _hHintDiv.onclick = function() {
134
+ _hHintDiv.remove();
135
+ _hHintDiv = null;
136
+ };
137
+ this._hHintDiv = _hHintDiv;
138
+ document.body.appendChild(this._hHintDiv);
139
+ }
104
140
  _genTemplate() {
105
141
  if (!this._template) {
106
142
  this._template = document.createElement('template');
@@ -173,7 +209,7 @@
173
209
  registerTdiv();
174
210
 
175
211
  // export default {
176
- // name
212
+ // name
177
213
  // }
178
214
 
179
215
  }));
@@ -55,6 +55,10 @@ function defineTag() {
55
55
  console.log('open-diandian: wx-open-launch-app appended');
56
56
  // 监听打开app失败的情况,跳转fallback链接
57
57
  this._openAppTag.addEventListener('error', (e) => {
58
+ if (this._isHarmony) {
59
+ this._showOpenInBrowserHint();
60
+ return;
61
+ }
58
62
  var tmplnk = document.createElement("a");
59
63
  tmplnk.href = this._alink_fallback;
60
64
  tmplnk.click();
@@ -75,6 +79,10 @@ function defineTag() {
75
79
  this.shadowRoot.appendChild(this._template.content);
76
80
  this._alink.addEventListener('click', this._handleAlinkClick.bind(this));
77
81
  console.log('open-diandian: open link appended');
82
+ // only test
83
+ // if(this._isHarmony){
84
+ // this._showOpenInBrowserHint();
85
+ // }
78
86
  }
79
87
  this._updateTagAttr();
80
88
  }
@@ -96,6 +104,34 @@ function defineTag() {
96
104
  this._alink = null;
97
105
  }
98
106
  }
107
+ _showOpenInBrowserHint() { // 提示用户在浏览器中打开
108
+ console.log('open-diandian: showOpenInBrowserHint');
109
+ let _hHintDiv = document.getElementById('open-diandian-h-hint-div');
110
+ if(_hHintDiv){
111
+ _hHintDiv.remove();
112
+ _hHintDiv = null;
113
+ }
114
+ // https://asset.tuwan.com/images/llqdk.png
115
+ _hHintDiv = document.createElement('div');
116
+ _hHintDiv.id = 'open-diandian-h-hint-div';
117
+ _hHintDiv.style.position = 'fixed';
118
+ _hHintDiv.style.top = '0';
119
+ _hHintDiv.style.left = '0';
120
+ _hHintDiv.style.width = '100%';
121
+ _hHintDiv.style.height = '100%';
122
+ _hHintDiv.style.zIndex = '100000';
123
+ _hHintDiv.style.backgroundImage = 'url(https://asset.tuwan.com/images/llqdk.png)';
124
+ _hHintDiv.style.backgroundRepeat = 'no-repeat';
125
+ _hHintDiv.style.backgroundSize = '80vw auto';
126
+ _hHintDiv.style.backgroundPosition = 'top right';
127
+ _hHintDiv.style.backgroundColor = 'rgba(0,0,0,0.5)';
128
+ _hHintDiv.onclick = function() {
129
+ _hHintDiv.remove();
130
+ _hHintDiv = null;
131
+ };
132
+ this._hHintDiv = _hHintDiv;
133
+ document.body.appendChild(this._hHintDiv);
134
+ }
99
135
  _genTemplate() {
100
136
  if (!this._template) {
101
137
  this._template = document.createElement('template');
@@ -168,5 +204,5 @@ function registerTdiv() {
168
204
  registerTdiv();
169
205
 
170
206
  // export default {
171
- // name
207
+ // name
172
208
  // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npx -y rimraf dist && rollup -c",