@dcloudio/uni-cli-shared 2.0.0-alpha-33020211130001 → 2.0.1-33320211224001

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.
@@ -147,7 +147,7 @@ export default {
147
147
  setBackgroundTextStyle () {
148
148
  // TODO h5 app-plus 暂不支持
149
149
  // #ifdef MP
150
- uni.setBackgroundTextStyle({
150
+ uni.setBackgroundTextStyle && uni.setBackgroundTextStyle({
151
151
  textStyle: this.backgroundTextStyle
152
152
  })
153
153
  // #endif
@@ -155,7 +155,7 @@ export default {
155
155
  setBackgroundColor () {
156
156
  // TODO h5 app-plus 暂不支持
157
157
  // #ifdef MP
158
- uni.setBackgroundColor({
158
+ uni.setBackgroundColor && uni.setBackgroundColor({
159
159
  backgroundColor: this.backgroundColor,
160
160
  backgroundColorTop: this.backgroundColorTop,
161
161
  backgroundColorBottom: this.backgroundColorBottom
package/lib/platform.js CHANGED
@@ -17,7 +17,26 @@ function getShadowCss () {
17
17
  if (process.env.UNI_PLATFORM === 'h5') {
18
18
  tagName = 'body'
19
19
  }
20
- return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}100%{background-image:url(https://cdn.dcloud.net.cn/img/shadow-grey.png)}}`
20
+ const cdn = getShadowCdn()
21
+ return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}`
22
+ }
23
+ const cdns = {
24
+ 'mp-weixin': 1,
25
+ 'mp-alipay': 2,
26
+ 'mp-baidu': 3,
27
+ 'mp-toutiao': 4,
28
+ 'mp-qq': 5,
29
+ 'mp-360': 7,
30
+ 'mp-dingtalk': 8,
31
+ 'mp-kuaishou': 9,
32
+ 'mp-lark': 10,
33
+ 'quickapp-webview-huawei': 200,
34
+ 'quickapp-webview-union': 201
35
+ }
36
+
37
+ function getShadowCdn () {
38
+ const index = cdns[process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM] || ''
39
+ return `https://cdn${index}.dcloud.net.cn`
21
40
  }
22
41
 
23
42
  // 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在
@@ -34,7 +53,8 @@ module.exports = {
34
53
  normalizeNodeModules,
35
54
  isInHBuilderX,
36
55
  isInHBuilderXAlpha,
37
- runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '', 'weapp-tools')),
56
+ runByHBuilderX: isInHBuilderX || fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS || '',
57
+ 'weapp-tools')),
38
58
  getFlexDirection (json) {
39
59
  let flexDir = 'column'
40
60
  if (json && json.nvue && json.nvue['flex-direction']) {
@@ -129,7 +149,7 @@ module.exports = {
129
149
  if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') {
130
150
  tagName = 'image'
131
151
  }
132
- return `<${tagName} src="https://cdn.dcloud.net.cn/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
152
+ return `<${tagName} src="${getShadowCdn()}/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
133
153
  },
134
154
  getPlatformScss () {
135
155
  return SCSS
@@ -141,7 +161,9 @@ module.exports = {
141
161
  return {
142
162
  sourceType: 'module',
143
163
  plugins: [
144
- ['pipelineOperator', { proposal: 'minimal' }],
164
+ ['pipelineOperator', {
165
+ proposal: 'minimal'
166
+ }],
145
167
  'doExpressions',
146
168
  'optionalChaining',
147
169
  'typescript',
@@ -152,4 +174,4 @@ module.exports = {
152
174
  ]
153
175
  }
154
176
  }
155
- }
177
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.0-alpha-33020211130001",
3
+ "version": "2.0.1-33320211224001",
4
4
  "description": "uni-cli-shared",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "postcss-urlrewrite": "^0.2.2",
24
24
  "strip-json-comments": "^2.0.1"
25
25
  },
26
- "gitHead": "7bb03ce723a5028a241a5ae4bd010c17ab5ea6ee"
26
+ "gitHead": "30f3c9d6642904e10fa2ea878ad02a348ecb137d"
27
27
  }