@dcloudio/uni-h5 2.0.0 → 2.0.1-32920211122002

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.
Files changed (157) hide show
  1. package/dist/automator.js +1 -1
  2. package/dist/index.css +1 -1
  3. package/dist/index.umd.min.js +1 -1
  4. package/lib/apis.js +14 -4
  5. package/lib/h5/uni.automator.js +1 -1
  6. package/lib/modules.json +4 -1
  7. package/manifest.json +49 -0
  8. package/package.json +2 -3
  9. package/src/core/helpers/api.js +1 -1
  10. package/src/core/helpers/constants.js +1 -0
  11. package/src/core/helpers/i18n/en.json +4 -2
  12. package/src/core/helpers/i18n/es.json +4 -1
  13. package/src/core/helpers/i18n/fr.json +4 -1
  14. package/src/core/helpers/i18n/index.js +155 -4
  15. package/src/core/helpers/i18n/zh-Hans.json +4 -1
  16. package/src/core/helpers/i18n/zh-Hant.json +4 -1
  17. package/src/core/helpers/index.js +1 -1
  18. package/src/core/helpers/interceptor.js +19 -15
  19. package/src/core/helpers/promise.js +1 -1
  20. package/src/core/helpers/protocol/device/set-clipboard-data.js +11 -2
  21. package/src/core/helpers/protocol/network/request.js +14 -1
  22. package/src/core/helpers/protocol/network/upload-file.js +1 -1
  23. package/src/core/helpers/protocol/ui/popup.js +2 -2
  24. package/src/core/runtime/base.js +2 -0
  25. package/src/core/runtime/locale.js +37 -0
  26. package/src/core/runtime/web-view/index.js +4 -0
  27. package/src/core/runtime/wrapper/create-subpackage-app.js +7 -6
  28. package/src/core/runtime/wrapper/util.js +6 -1
  29. package/src/core/service/api/base/interceptor.js +1 -1
  30. package/src/core/service/api/context/canvas.js +3 -2
  31. package/src/core/service/api/context/create-map-context.js +8 -1
  32. package/src/core/service/api/ui/locale.js +50 -0
  33. package/src/core/service/plugins/app/create-app.js +8 -3
  34. package/src/core/service/plugins/app/index.js +2 -2
  35. package/src/core/service/plugins/index.js +8 -2
  36. package/src/core/view/bridge/subscribe/api/request-component-observer.js +16 -1
  37. package/src/core/view/components/canvas/index.vue +3 -1
  38. package/src/core/view/components/editor/formats/image.js +3 -1
  39. package/src/core/view/components/editor/formats/index.js +3 -1
  40. package/src/core/view/components/editor/formats/link.js +9 -0
  41. package/src/core/view/components/editor/index.vue +33 -3
  42. package/src/core/view/components/image/index.vue +4 -5
  43. package/src/core/view/components/input/index.vue +53 -25
  44. package/src/core/view/components/picker-view-column/index.vue +1 -0
  45. package/src/core/view/components/progress/index.vue +20 -13
  46. package/src/core/view/components/rich-text/index.vue +13 -1
  47. package/src/core/view/components/rich-text/nodes-parser.js +23 -4
  48. package/src/core/view/components/scroll-view/index.vue +253 -122
  49. package/src/core/view/components/slider/index.vue +1 -1
  50. package/src/core/view/components/swiper/index.vue +3 -0
  51. package/src/core/view/components/textarea/index.vue +7 -3
  52. package/src/core/view/index.css +4 -0
  53. package/src/core/view/mixins/field.js +27 -9
  54. package/src/core/view/mixins/interact.js +13 -11
  55. package/src/core/view/mixins/keyboard.js +42 -26
  56. package/src/core/view/mixins/touchtrack.js +2 -2
  57. package/src/core/view/plugins/index.js +1 -1
  58. package/src/platforms/app-plus/constants.js +1 -0
  59. package/src/platforms/app-plus/helpers/get-real-path.js +7 -4
  60. package/src/platforms/app-plus/helpers/uuid.js +1 -1
  61. package/src/platforms/app-plus/service/api/ad/ad-base.js +159 -0
  62. package/src/platforms/app-plus/service/api/ad/ad.js +4 -8
  63. package/src/platforms/app-plus/service/api/ad/full-screen-video-ad.js +5 -98
  64. package/src/platforms/app-plus/service/api/ad/interactive-ad.js +257 -0
  65. package/src/platforms/app-plus/service/api/ad/interstitial-ad.js +15 -0
  66. package/src/platforms/app-plus/service/api/ad/rewarded-video-ad.js +15 -2
  67. package/src/platforms/app-plus/service/api/device/system.js +3 -2
  68. package/src/platforms/app-plus/service/api/file/open-document.js +7 -15
  69. package/src/platforms/app-plus/service/api/index.js +2 -0
  70. package/src/platforms/app-plus/service/api/location/get-location.js +8 -7
  71. package/src/platforms/app-plus/service/api/media/choose-image.js +22 -51
  72. package/src/platforms/app-plus/service/api/media/choose-video.js +19 -36
  73. package/src/platforms/app-plus/service/api/media/compress-video.js +2 -2
  74. package/src/platforms/app-plus/service/api/media/get-video-info.js +5 -2
  75. package/src/platforms/app-plus/service/api/network/request.js +27 -1
  76. package/src/platforms/app-plus/service/api/network/upload-file.js +1 -1
  77. package/src/platforms/app-plus/service/api/plugin/oauth.js +140 -8
  78. package/src/platforms/app-plus/service/api/storage/storage.js +1 -1
  79. package/src/platforms/app-plus/service/api/ui/popup.js +21 -11
  80. package/src/platforms/app-plus/service/api/ui/tab-bar.js +3 -2
  81. package/src/platforms/app-plus/service/api/util.js +5 -1
  82. package/src/platforms/app-plus/service/framework/app.js +21 -5
  83. package/src/platforms/app-plus/service/framework/config.js +1 -0
  84. package/src/platforms/app-plus/service/framework/plugins/index.js +8 -2
  85. package/src/platforms/app-plus/service/framework/plugins/lifecycle.js +2 -2
  86. package/src/platforms/app-plus/service/framework/subscribe-handlers/index.js +1 -1
  87. package/src/platforms/app-plus/service/framework/tab-bar.js +12 -2
  88. package/src/platforms/app-plus/service/framework/webview/index.js +2 -2
  89. package/src/platforms/app-plus/service/framework/webview/parser/title-nview-parser.js +73 -30
  90. package/src/platforms/app-plus/service/framework/webview/parser/webview-style-parser.js +16 -16
  91. package/src/platforms/app-plus/service/index.js +10 -3
  92. package/src/platforms/app-plus/service/publish-handler.js +3 -0
  93. package/src/platforms/app-plus/view/bridge/subscribe/index.js +5 -3
  94. package/src/platforms/app-plus/view/components/ad/index.vue +53 -44
  95. package/src/platforms/app-plus/view/components/cover-view/index.vue +13 -7
  96. package/src/platforms/app-plus/view/components/map/index.vue +29 -27
  97. package/src/platforms/app-plus/view/components/video/index.vue +40 -24
  98. package/src/platforms/app-plus/view/framework/plugins/gesture.js +17 -0
  99. package/src/platforms/app-plus/view/framework/plugins/index.js +3 -1
  100. package/src/platforms/app-plus/view/index.css +4 -0
  101. package/src/platforms/app-plus/view/mixins/cover.js +10 -15
  102. package/src/platforms/app-plus/view/mixins/native.js +45 -3
  103. package/src/platforms/app-plus-nvue/service/api/context/operate-map-player.js +3 -0
  104. package/src/platforms/h5/components/app/observable.js +3 -2
  105. package/src/platforms/h5/components/app/popup/mixins/modal.js +3 -3
  106. package/src/platforms/h5/components/app/popup/modal.vue +38 -2
  107. package/src/platforms/h5/components/app/popup/toast.vue +9 -1
  108. package/src/platforms/h5/components/app/tabBar.vue +39 -17
  109. package/src/platforms/h5/components/page/index.vue +5 -3
  110. package/src/platforms/h5/components/page/pageHead.vue +94 -75
  111. package/src/platforms/h5/components/system-routes/choose-location/index.vue +127 -66
  112. package/src/platforms/h5/components/system-routes/open-location/index.vue +193 -38
  113. package/src/platforms/h5/helpers/location.js +26 -0
  114. package/src/platforms/h5/helpers/todo-api.js +2 -2
  115. package/src/platforms/h5/service/api/device/clipboard.js +41 -0
  116. package/src/platforms/h5/service/api/device/get-system-info.js +75 -0
  117. package/src/platforms/h5/service/api/location/get-location.js +47 -18
  118. package/src/platforms/h5/service/api/media/MIMEType.js +53 -0
  119. package/src/platforms/h5/service/api/media/choose-file.js +9 -1
  120. package/src/platforms/h5/service/api/media/choose-image.js +9 -2
  121. package/src/platforms/h5/service/api/media/choose-video.js +9 -1
  122. package/src/platforms/h5/service/api/media/create_input.js +12 -3
  123. package/src/platforms/h5/service/api/ui/popup.js +3 -5
  124. package/src/platforms/h5/service/api/ui/tab-bar.js +1 -1
  125. package/src/platforms/h5/service/index.js +5 -0
  126. package/src/platforms/h5/view/bridge/subscribe/index.js +3 -2
  127. package/src/platforms/h5/view/components/ad/index.vue +112 -69
  128. package/src/platforms/h5/view/components/map/index.vue +96 -349
  129. package/src/platforms/h5/view/components/map/map-marker.js +287 -0
  130. package/src/platforms/h5/view/components/map/maps/callout.js +117 -0
  131. package/src/platforms/h5/view/components/map/maps/index.js +55 -0
  132. package/src/platforms/h5/view/components/video/index.vue +1 -1
  133. package/src/platforms/h5/view/index.css +4 -0
  134. package/src/platforms/mp-alipay/runtime/api/protocols.js +30 -3
  135. package/src/platforms/mp-baidu/runtime/api/protocols.js +5 -0
  136. package/src/platforms/mp-baidu/runtime/wrapper/component-parser.js +20 -18
  137. package/src/platforms/mp-baidu/runtime/wrapper/util.js +2 -1
  138. package/src/platforms/mp-kuaishou/runtime/api/protocols.js +3 -1
  139. package/src/platforms/mp-kuaishou/runtime/wrapper/component-parser.js +21 -1
  140. package/src/platforms/mp-lark/runtime/api/index.js +0 -0
  141. package/src/platforms/mp-lark/runtime/api/protocols.js +68 -0
  142. package/src/platforms/mp-lark/runtime/api/providers.js +6 -0
  143. package/src/platforms/mp-lark/runtime/index.js +1 -0
  144. package/src/platforms/mp-lark/runtime/web-view.js +11 -0
  145. package/src/platforms/mp-lark/runtime/wrapper/app-parser.js +33 -0
  146. package/src/platforms/mp-lark/runtime/wrapper/component-parser.js +50 -0
  147. package/src/platforms/mp-lark/runtime/wrapper/page-parser.js +39 -0
  148. package/src/platforms/mp-lark/runtime/wrapper/util.js +64 -0
  149. package/src/platforms/mp-qq/runtime/api/protocols.js +3 -1
  150. package/src/platforms/mp-toutiao/runtime/api/protocols.js +2 -0
  151. package/src/platforms/mp-toutiao/runtime/wrapper/component-parser.js +35 -19
  152. package/src/platforms/mp-weixin/helpers/get-user-profile.js +6 -0
  153. package/src/platforms/mp-weixin/runtime/index.js +6 -7
  154. package/src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js +197 -126
  155. package/src/platforms/mp-weixin/runtime/wrapper/fix-set-data.js +37 -0
  156. package/src/shared/uni-id-mixin.js +77 -0
  157. package/src/shared/util.js +2 -0
@@ -1,14 +1,8 @@
1
- import {
2
- parseTitleNView
3
- } from './title-nview-parser'
1
+ import { parseTitleNView } from './title-nview-parser'
4
2
 
5
- import {
6
- parsePullToRefresh
7
- } from './pull-to-refresh-parser'
3
+ import { parsePullToRefresh } from './pull-to-refresh-parser'
8
4
 
9
- import {
10
- parseStyleUnit
11
- } from './style-unit-parser'
5
+ import { parseStyleUnit } from './style-unit-parser'
12
6
 
13
7
  const WEBVIEW_STYLE_BLACKLIST = [
14
8
  'navigationBarBackgroundColor',
@@ -33,10 +27,12 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
33
27
  }
34
28
 
35
29
  // 合并
36
- routeOptions.window = parseStyleUnit(Object.assign(
37
- JSON.parse(JSON.stringify(__uniConfig.window || {})),
38
- routeOptions.window || {}
39
- ))
30
+ routeOptions.window = parseStyleUnit(
31
+ Object.assign(
32
+ JSON.parse(JSON.stringify(__uniConfig.window || {})),
33
+ routeOptions.window || {}
34
+ )
35
+ )
40
36
 
41
37
  Object.keys(routeOptions.window).forEach(name => {
42
38
  if (WEBVIEW_STYLE_BLACKLIST.indexOf(name) === -1) {
@@ -45,7 +41,10 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
45
41
  })
46
42
 
47
43
  const backgroundColor = routeOptions.window.backgroundColor
48
- if (/^#[a-z0-9]{6}$/i.test(backgroundColor) || backgroundColor === 'transparent') {
44
+ if (
45
+ /^#[a-z0-9]{6}$/i.test(backgroundColor) ||
46
+ backgroundColor === 'transparent'
47
+ ) {
49
48
  if (!webviewStyle.background) {
50
49
  webviewStyle.background = backgroundColor
51
50
  }
@@ -54,7 +53,7 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
54
53
  }
55
54
  }
56
55
 
57
- const titleNView = parseTitleNView(routeOptions)
56
+ const titleNView = parseTitleNView(id, routeOptions)
58
57
  if (titleNView) {
59
58
  if (
60
59
  id === 1 &&
@@ -79,7 +78,8 @@ export function parseWebviewStyle (id, path, routeOptions = {}) {
79
78
  delete webviewStyle.popGesture
80
79
  }
81
80
 
82
- if (routeOptions.meta.isQuit) { // 退出
81
+ if (routeOptions.meta.isQuit) {
82
+ // 退出
83
83
  webviewStyle.popGesture = plus.os.name === 'iOS' ? 'appback' : 'none'
84
84
  }
85
85
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  uni
3
3
  } from 'uni-core/service/uni'
4
-
4
+ import EventChannel from 'uni-helpers/EventChannel'
5
5
  import {
6
6
  invokeCallbackHandler,
7
7
  removeCallbackHandler
@@ -31,6 +31,12 @@ import {
31
31
 
32
32
  import vuePlugin from './framework/plugins'
33
33
 
34
+ import {
35
+ initI18n
36
+ } from 'uni-helpers/i18n'
37
+
38
+ initI18n()
39
+
34
40
  // 挂靠在uni上,暂不做全局导出
35
41
  uni.__$wx__ = wx
36
42
 
@@ -45,5 +51,6 @@ export default {
45
51
  __registerPage: registerPage,
46
52
  uni,
47
53
  getApp,
48
- getCurrentPages
49
- }
54
+ getCurrentPages,
55
+ EventChannel
56
+ }
@@ -8,6 +8,9 @@ export function publishHandler (eventType, args, pageIds) {
8
8
  }
9
9
  const evalJSCode =
10
10
  `typeof UniViewJSBridge !== 'undefined' && UniViewJSBridge.subscribeHandler("${eventType}",${args},__PAGE_ID__)`
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ console.log(`UNIAPP[publishHandler]:[${+new Date()}]`, 'length', evalJSCode.length)
13
+ }
11
14
  pageIds.forEach(id => {
12
15
  const webview = plus.webview.getWebviewById(String(id))
13
16
  webview && webview.evalJS(evalJSCode.replace('__PAGE_ID__', id))
@@ -16,7 +16,8 @@ import {
16
16
  } from '../../constants'
17
17
 
18
18
  import {
19
- WEBVIEW_READY
19
+ WEBVIEW_READY,
20
+ SET_LOCALE
20
21
  } from '../../../constants'
21
22
 
22
23
  const passiveOptions = supportsPassive ? {
@@ -56,7 +57,7 @@ function onPageCreate ({
56
57
  onPageScroll,
57
58
  onPageReachBottom,
58
59
  onReachBottomDistance
59
- }, pageId) {
60
+ }, pageId) {
60
61
  setLocale(locale)
61
62
 
62
63
  onCssVar({
@@ -85,4 +86,5 @@ function onWebviewReady () { // service 主动发起检测
85
86
  export default function initSubscribe (subscribe) {
86
87
  subscribe(WEBVIEW_READY, onWebviewReady)
87
88
  subscribe(ON_PAGE_CREATE, onPageCreate)
88
- }
89
+ subscribe(SET_LOCALE, setLocale)
90
+ }
@@ -35,6 +35,10 @@ export default {
35
35
  dataCount: {
36
36
  type: Number,
37
37
  default: 5
38
+ },
39
+ channel: {
40
+ type: String,
41
+ default: ''
38
42
  }
39
43
  },
40
44
  data () {
@@ -69,53 +73,55 @@ export default {
69
73
  }
70
74
  },
71
75
  mounted () {
72
- this._adId = 'AdView-' + this._newGUID()
73
- const adStyle = Object.assign({
74
- id: this._adId
75
- }, this.position)
76
- const adView = this.adView = plus.ad.createAdView(adStyle)
77
- adView.interceptTouchEvent(false)
78
- plus.webview.currentWebview().append(adView)
79
- if (this.hidden) {
80
- adView.hide()
81
- }
82
- this.$watch('attrs', () => {
83
- this._request()
84
- }, {
85
- deep: true
86
- })
87
- this.$watch('position', () => {
88
- this.adView && this.adView.setStyle(this.position)
89
- }, {
90
- deep: true
91
- })
92
- // 模板渲染有效
93
- adView.setDislikeListener && adView.setDislikeListener((data) => {
94
- this.adView && this.adView.close()
95
- this.$refs.container.style.height = '0px'
96
-
97
- this._updateView()
76
+ this._onParentReady(() => {
77
+ this._adId = 'AdView-' + this._newGUID()
78
+ const adStyle = Object.assign({
79
+ id: this._adId
80
+ }, this.position)
81
+ const adView = this.adView = plus.ad.createAdView(adStyle)
82
+ adView.interceptTouchEvent(false)
83
+ plus.webview.currentWebview().append(adView)
84
+ if (this.hidden) {
85
+ adView.hide()
86
+ }
87
+ this.$watch('attrs', () => {
88
+ this._request()
89
+ }, {
90
+ deep: true
91
+ })
92
+ this.$watch('position', () => {
93
+ this.adView && this.adView.setStyle(this.position)
94
+ }, {
95
+ deep: true
96
+ })
97
+ // 模板渲染有效
98
+ adView.setDislikeListener && adView.setDislikeListener((data) => {
99
+ this.adView && this.adView.close()
100
+ this.$refs.container.style.height = '0px'
98
101
 
99
- this.$trigger('close', {}, data)
100
- })
101
- adView.setRenderingListener && adView.setRenderingListener((data) => {
102
- if (data.result === 0) {
103
- this.$refs.container.style.height = data.height + 'px'
104
102
  this._updateView()
105
- } else {
106
- this.$trigger('error', {}, {
107
- errCode: data.result
108
- })
109
- }
110
- })
111
- adView.setAdClickedListener((data) => {
112
- this.$trigger('adclicked', {}, data)
113
- })
114
103
 
115
- this._callbackId = this.$page.id + this._adId
116
- UniViewJSBridge.subscribe(this._callbackId, this._handleAdData.bind(this))
104
+ this.$trigger('close', {}, data)
105
+ })
106
+ adView.setRenderingListener && adView.setRenderingListener((data) => {
107
+ if (data.result === 0) {
108
+ this.$refs.container.style.height = data.height + 'px'
109
+ this._updateView()
110
+ } else {
111
+ this.$trigger('error', {}, {
112
+ errCode: data.result
113
+ })
114
+ }
115
+ })
116
+ adView.setAdClickedListener((data) => {
117
+ this.$trigger('adclicked', {}, data)
118
+ })
119
+
120
+ this._callbackId = this.$page.id + this._adId
121
+ UniViewJSBridge.subscribe(this._callbackId, this._handleAdData.bind(this))
117
122
 
118
- this._request()
123
+ this._request()
124
+ })
119
125
  },
120
126
  beforeDestroy () {
121
127
  this.adView && this.adView.close()
@@ -150,7 +156,10 @@ export default {
150
156
  const data = {
151
157
  adpid: adpid || this.adpid,
152
158
  width: this.position.width,
153
- count: this.dataCount
159
+ count: this.dataCount,
160
+ ext: {
161
+ channel: this.channel
162
+ }
154
163
  }
155
164
  UniViewJSBridge.publishHandler('onAdMethodCallback', {
156
165
  callbackId: this._callbackId,
@@ -15,12 +15,17 @@ export default {
15
15
  render (createElement) {
16
16
  let coverContent = ''
17
17
  const $slots = this.$slots.default || []
18
- $slots.forEach(node => {
19
- if (!node.tag) {
20
- coverContent += node.text || ''
21
- }
22
- })
23
- this.coverContent = coverContent
18
+ const _slots = $slots.filter(node => node.tag)
19
+ if (!_slots.length) {
20
+ $slots.forEach(node => {
21
+ if (!node.tag) {
22
+ coverContent += node.text || ''
23
+ }
24
+ })
25
+ this.coverContent = coverContent
26
+ } else {
27
+ coverContent = _slots
28
+ }
24
29
  return createElement('uni-cover-view', {
25
30
  on: {
26
31
  on: this.$listeners
@@ -28,7 +33,7 @@ export default {
28
33
  }, [createElement('div', {
29
34
  ref: 'container',
30
35
  staticClass: 'uni-cover-view'
31
- }, [coverContent])])
36
+ }, [].concat(coverContent))])
32
37
  }
33
38
  }
34
39
  </script>
@@ -48,5 +53,6 @@ uni-cover-view[hidden] {
48
53
  uni-cover-view .uni-cover-view {
49
54
  width: 100%;
50
55
  height: 100%;
56
+ visibility: hidden;
51
57
  }
52
58
  </style>
@@ -189,34 +189,36 @@ export default {
189
189
  }
190
190
  },
191
191
  mounted () {
192
- const mapStyle = Object.assign({}, this.attrs, this.position)
193
- if (this.latitude && this.longitude) {
194
- mapStyle.center = new plus.maps.Point(this.longitude, this.latitude)
195
- }
196
- const map = this.map = plus.maps.create(this.$page.id + '-map-' + (this.id || Date.now()), mapStyle)
197
- map.__markers__ = []
198
- map.__markers_map__ = {}
199
- map.__lines__ = []
200
- map.__circles__ = []
201
- map.setZoom(parseInt(this.scale))
202
- plus.webview.currentWebview().append(map)
203
- if (this.hidden) {
204
- map.hide()
205
- }
206
- this.$watch('position', () => {
207
- this.map && this.map.setStyles(this.position)
208
- }, {
209
- deep: true
192
+ this._onParentReady(() => {
193
+ const mapStyle = Object.assign({}, this.attrs, this.position)
194
+ if (this.latitude && this.longitude) {
195
+ mapStyle.center = new plus.maps.Point(this.longitude, this.latitude)
196
+ }
197
+ const map = this.map = plus.maps.create(this.$page.id + '-map-' + (this.id || Date.now()), mapStyle)
198
+ map.__markers__ = []
199
+ map.__markers_map__ = {}
200
+ map.__lines__ = []
201
+ map.__circles__ = []
202
+ map.setZoom(parseInt(this.scale))
203
+ plus.webview.currentWebview().append(map)
204
+ if (this.hidden) {
205
+ map.hide()
206
+ }
207
+ this.$watch('position', () => {
208
+ this.map && this.map.setStyles(this.position)
209
+ }, {
210
+ deep: true
211
+ })
212
+ map.onclick = (e) => {
213
+ this.$trigger('click', {}, e)
214
+ }
215
+ map.onstatuschanged = (e) => {
216
+ this.$trigger('regionchange', {}, {})
217
+ }
218
+ this._addMarkers(this.markers)
219
+ this._addMapLines(this.polyline)
220
+ this._addMapCircles(this.circles)
210
221
  })
211
- map.onclick = (e) => {
212
- this.$trigger('click', {}, e)
213
- }
214
- map.onstatuschanged = (e) => {
215
- this.$trigger('regionchange', {}, {})
216
- }
217
- this._addMarkers(this.markers)
218
- this._addMapLines(this.polyline)
219
- this._addMapCircles(this.circles)
220
222
  },
221
223
  beforeDestroy () {
222
224
  this.map && this.map.close()
@@ -61,7 +61,9 @@ const attrs = [
61
61
  'showLoading',
62
62
  'codec',
63
63
  'httpCache',
64
- 'playStrategy'
64
+ 'playStrategy',
65
+ 'header',
66
+ 'advanced'
65
67
  ]
66
68
 
67
69
  export default {
@@ -169,6 +171,18 @@ export default {
169
171
  playStrategy: {
170
172
  type: [Number, String],
171
173
  default: 0
174
+ },
175
+ header: {
176
+ type: Object,
177
+ default () {
178
+ return {}
179
+ }
180
+ },
181
+ advanced: {
182
+ type: Array,
183
+ default () {
184
+ return []
185
+ }
172
186
  }
173
187
  },
174
188
  computed: {
@@ -183,30 +197,32 @@ export default {
183
197
  }
184
198
  },
185
199
  mounted () {
186
- const video = this.video = plus.video.createVideoPlayer('video' + Date.now(), Object.assign({}, this.attrs, this.position))
187
- plus.webview.currentWebview().append(video)
188
- if (this.hidden) {
189
- video.hide()
190
- }
191
- this.$watch('attrs', () => {
192
- this.video && this.video.setStyles(this.attrs)
193
- }, { deep: true })
194
- this.$watch('position', () => {
195
- this.video && this.video.setStyles(this.position)
196
- }, { deep: true })
197
- this.$watch('hidden', (val) => {
198
- const video = this.video
199
- if (video) {
200
- video[val ? 'hide' : 'show']()
201
- // iOS 隐藏状态设置 setStyles 不生效
202
- if (!val) {
203
- video.setStyles(this.position)
204
- }
200
+ this._onParentReady(() => {
201
+ const video = this.video = plus.video.createVideoPlayer('video' + Date.now(), Object.assign({}, this.attrs, this.position))
202
+ plus.webview.currentWebview().append(video)
203
+ if (this.hidden) {
204
+ video.hide()
205
205
  }
206
- })
207
- events.forEach(key => {
208
- video.addEventListener(key, (e) => {
209
- this.$trigger(key, {}, { ...e.detail })
206
+ this.$watch('attrs', () => {
207
+ this.video && this.video.setStyles(this.attrs)
208
+ }, { deep: true })
209
+ this.$watch('position', () => {
210
+ this.video && this.video.setStyles(this.position)
211
+ }, { deep: true })
212
+ this.$watch('hidden', (val) => {
213
+ const video = this.video
214
+ if (video) {
215
+ video[val ? 'hide' : 'show']()
216
+ // iOS 隐藏状态设置 setStyles 不生效
217
+ if (!val) {
218
+ video.setStyles(this.position)
219
+ }
220
+ }
221
+ })
222
+ events.forEach(key => {
223
+ video.addEventListener(key, (e) => {
224
+ this.$trigger(key, {}, { ...e.detail })
225
+ })
210
226
  })
211
227
  })
212
228
  },
@@ -0,0 +1,17 @@
1
+ if (String(navigator.vendor).indexOf('Apple') === 0) {
2
+ let firstEvent
3
+ let timeout
4
+ // 用于全局禁用 iOS 双击包含手势
5
+ document.documentElement.addEventListener('click', event => {
6
+ const TIME_MAX = 450
7
+ const PAGE_MAX = 44
8
+ clearTimeout(timeout)
9
+ if (firstEvent && Math.abs(event.pageX - firstEvent.pageX) <= PAGE_MAX && Math.abs(event.pageY - firstEvent.pageY) <= PAGE_MAX && event.timeStamp - firstEvent.timeStamp <= TIME_MAX) {
10
+ event.preventDefault()
11
+ }
12
+ firstEvent = event
13
+ timeout = setTimeout(() => {
14
+ firstEvent = null
15
+ }, TIME_MAX)
16
+ })
17
+ }
@@ -12,6 +12,8 @@ import {
12
12
  initEvent
13
13
  } from './event'
14
14
 
15
+ import './gesture'
16
+
15
17
  export default {
16
18
  install (Vue, options) {
17
19
  if (process.env.NODE_ENV !== 'production') {
@@ -29,4 +31,4 @@ export default {
29
31
 
30
32
  initEvent(Vue)
31
33
  }
32
- }
34
+ }
@@ -72,6 +72,10 @@ body {
72
72
  content: "\EA08";
73
73
  }
74
74
 
75
+ .uni-icon-error:before {
76
+ content: "\EA0B";
77
+ }
78
+
75
79
  .uni-loading,
76
80
  uni-button[loading]:before {
77
81
  background: transparent url("data:image/svg+xml;base64, PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=") no-repeat;
@@ -8,7 +8,8 @@ export default {
8
8
  name: 'Cover',
9
9
  data () {
10
10
  return {
11
- style: {}
11
+ style: {},
12
+ parentPosition: {}
12
13
  }
13
14
  },
14
15
  computed: {
@@ -17,12 +18,12 @@ export default {
17
18
  for (const key in this.position) {
18
19
  let val = this.position[key]
19
20
  const valNumber = parseFloat(val)
20
- const parentValNumber = parseFloat(this._nativeParent.position[key])
21
+ const parentValNumber = parseFloat(this.parentPosition[key])
21
22
  if (key === 'top' || key === 'left') {
22
23
  val = Math.max(valNumber, parentValNumber) + 'px'
23
24
  } else if (key === 'width' || key === 'height') {
24
25
  const base = key === 'width' ? 'left' : 'top'
25
- const parentStart = parseFloat(this._nativeParent.position[base])
26
+ const parentStart = parseFloat(this.parentPosition[base])
26
27
  const viewStart = parseFloat(this.position[base])
27
28
  const diff1 = Math.max(parentStart - viewStart, 0)
28
29
  const diff2 = Math.max((viewStart + valNumber) - (parentStart + parentValNumber), 0)
@@ -91,16 +92,10 @@ export default {
91
92
  this._nativeParent = $parent
92
93
  },
93
94
  mounted () {
94
- this._updateStyle()
95
- const $nativeParent = this._nativeParent
96
- if ($nativeParent.isNative) {
97
- if ($nativeParent._isMounted) {
98
- this._onCanInsert()
99
- } else {
100
- $nativeParent.onCanInsertCallbacks.push(() => {
101
- this._onCanInsert()
102
- })
103
- }
95
+ this._onParentReady((parentPosition) => {
96
+ this.parentPosition = this._nativeParent.position || parentPosition
97
+ this._updateStyle()
98
+ this._onCanInsert()
104
99
  this.$watch('hidden', (val) => {
105
100
  this.cover && this.cover[val ? 'hide' : 'show']()
106
101
  })
@@ -115,7 +110,7 @@ export default {
115
110
  }
116
111
  }, { deep: true })
117
112
  this.$on('uni-view-update', this._requestStyleUpdate)
118
- }
113
+ })
119
114
  },
120
115
  beforeDestroy () {
121
116
  if (this._nativeParent.isNative) {
@@ -139,7 +134,7 @@ export default {
139
134
  for (const key in this.position) {
140
135
  let val = this.position[key]
141
136
  if (key === 'top' || key === 'left') {
142
- val = Math.min((parseFloat(val) - parseFloat(this._nativeParent.position[key])), 0) + 'px'
137
+ val = Math.min((parseFloat(val) - parseFloat(this.parentPosition[key])), 0) + 'px'
143
138
  }
144
139
  position[key] = val
145
140
  }
@@ -26,15 +26,23 @@ export default {
26
26
  hidden: false
27
27
  }
28
28
  },
29
+ provide () {
30
+ return {
31
+ parentOnDraw: this._onDraw
32
+ }
33
+ },
34
+ inject: {
35
+ parentOnDraw: { default: null }
36
+ },
29
37
  created () {
30
38
  this.isNative = true
31
39
  this.onCanInsertCallbacks = []
40
+ this.onDrawCallbacks = []
32
41
  },
33
42
  mounted () {
34
43
  this._updatePosition()
35
- this.$nextTick(() => {
36
- this.onCanInsertCallbacks.forEach(callback => callback())
37
- })
44
+ this.onCanInsertCallbacks.forEach(callback => callback())
45
+ this.onCanInsertCallbacks = null
38
46
  this.$on('uni-view-update', this._requestPositionUpdate)
39
47
  },
40
48
  methods: {
@@ -60,6 +68,40 @@ export default {
60
68
  delete this._positionUpdateRequest
61
69
  this._updatePosition()
62
70
  })
71
+ },
72
+ _onParentReady (parentReadyCallback) {
73
+ const callback = (parentPosition) => {
74
+ parentReadyCallback(parentPosition)
75
+ this.onDrawCallbacks.forEach(callback => callback(this.position))
76
+ this.onDrawCallbacks = null
77
+ }
78
+ this._onSelfReady(() => {
79
+ if (this.parentOnDraw) {
80
+ this.parentOnDraw(callback)
81
+ } else {
82
+ callback({
83
+ top: '0px',
84
+ left: '0px',
85
+ width: Number.MAX_SAFE_INTEGER + 'px',
86
+ height: Number.MAX_SAFE_INTEGER + 'px',
87
+ position: 'static'
88
+ })
89
+ }
90
+ })
91
+ },
92
+ _onSelfReady (callback) {
93
+ if (this.onCanInsertCallbacks) {
94
+ this.onCanInsertCallbacks.push(callback)
95
+ } else {
96
+ callback()
97
+ }
98
+ },
99
+ _onDraw (callback) {
100
+ if (this.onDrawCallbacks) {
101
+ this.onDrawCallbacks.push(callback)
102
+ } else {
103
+ callback(this.position)
104
+ }
63
105
  }
64
106
  }
65
107
  }
@@ -52,6 +52,9 @@ const METHODS = {
52
52
  },
53
53
  openMapApp (ctx, args) {
54
54
  return invokeVmMethod(ctx, 'openMapApp', args)
55
+ },
56
+ on (ctx, args) {
57
+ return ctx.on(args.name, args.callback)
55
58
  }
56
59
  }
57
60
 
@@ -1,3 +1,4 @@
1
1
  import Vue from 'vue'
2
- __uniConfig.tabBar = Vue.observable(__uniConfig.tabBar || {})
3
- export const tabBar = __uniConfig.tabBar
2
+ import { initTabBarI18n } from 'uni-helpers/i18n'
3
+ __uniConfig.tabBar = Vue.observable(initTabBarI18n(__uniConfig.tabBar || {}))
4
+ export const tabBar = __uniConfig.tabBar
@@ -21,9 +21,9 @@ export default {
21
21
  },
22
22
  methods: {
23
23
  // 处理 modal close 回调
24
- _onModalClose (type) {
24
+ _onModalClose (res) {
25
25
  this.showModal.visible = false
26
- isFn(this.onModalCloseCallback) && this.onModalCloseCallback(type)
26
+ isFn(this.onModalCloseCallback) && this.onModalCloseCallback(res)
27
27
  }
28
28
  }
29
- }
29
+ }