Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenYFan_OHHH
uni-app
提交
f96cfa22
U
uni-app
项目概览
ChenYFan_OHHH
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f96cfa22
编写于
9月 07, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(h5): add unsupported components
上级
11908c9f
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
807 addition
and
629 deletion
+807
-629
packages/uni-components/src/helpers/component.ts
packages/uni-components/src/helpers/component.ts
+23
-1
packages/uni-components/src/index.ts
packages/uni-components/src/index.ts
+1
-0
packages/uni-h5-vite/src/plugin/esbuild/esbuildPrePlugin.ts
packages/uni-h5-vite/src/plugin/esbuild/esbuildPrePlugin.ts
+27
-0
packages/uni-h5-vite/src/plugin/index.ts
packages/uni-h5-vite/src/plugin/index.ts
+11
-2
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+84
-64
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+51
-37
packages/uni-h5/src/view/components/ad-content-page/index.tsx
...ages/uni-h5/src/view/components/ad-content-page/index.tsx
+3
-0
packages/uni-h5/src/view/components/ad-draw/index.tsx
packages/uni-h5/src/view/components/ad-draw/index.tsx
+3
-0
packages/uni-h5/src/view/components/ad/index.bak.tsx
packages/uni-h5/src/view/components/ad/index.bak.tsx
+524
-0
packages/uni-h5/src/view/components/ad/index.tsx
packages/uni-h5/src/view/components/ad/index.tsx
+2
-523
packages/uni-h5/src/view/components/camera/index.tsx
packages/uni-h5/src/view/components/camera/index.tsx
+3
-0
packages/uni-h5/src/view/components/index.ts
packages/uni-h5/src/view/components/index.ts
+21
-1
packages/uni-h5/src/view/components/live-player/index.tsx
packages/uni-h5/src/view/components/live-player/index.tsx
+3
-0
packages/uni-h5/src/view/components/live-pusher/index.tsx
packages/uni-h5/src/view/components/live-pusher/index.tsx
+3
-0
packages/uni-h5/style/ad-content-page.css
packages/uni-h5/style/ad-content-page.css
+8
-0
packages/uni-h5/style/ad-draw.css
packages/uni-h5/style/ad-draw.css
+8
-0
packages/uni-h5/style/camera.css
packages/uni-h5/style/camera.css
+8
-0
packages/uni-h5/style/live-player.css
packages/uni-h5/style/live-player.css
+8
-0
packages/uni-h5/style/live-pusher.css
packages/uni-h5/style/live-pusher.css
+8
-0
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+2
-0
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+2
-0
packages/uni-shared/src/tags.ts
packages/uni-shared/src/tags.ts
+2
-0
packages/vite-plugin-uni/src/config/index.ts
packages/vite-plugin-uni/src/config/index.ts
+2
-1
未找到文件。
packages/uni-components/src/helpers/component.ts
浏览文件 @
f96cfa22
import
{
ComponentOptions
,
defineComponent
}
from
'
vue
'
import
{
ComponentOptions
,
createElementBlock
,
defineComponent
,
openBlock
,
}
from
'
vue
'
import
{
camelize
,
capitalize
}
from
'
@vue/shared
'
import
animation
from
'
./animation
'
import
animation
from
'
./animation
'
/**
/**
* 内置组件(对外,比如view)
* 内置组件(对外,比如view)
...
@@ -27,3 +33,19 @@ export const defineSystemComponent: typeof defineComponent = (options: any) => {
...
@@ -27,3 +33,19 @@ export const defineSystemComponent: typeof defineComponent = (options: any) => {
}
}
return
defineComponent
(
options
)
return
defineComponent
(
options
)
}
}
/**
* 暂未支持的组件
* @param name
* @returns
*/
export
const
defineUnsupportedComponent
=
(
name
:
string
)
=>
{
return
defineBuiltInComponent
({
name
:
capitalize
(
camelize
(
name
)),
setup
()
{
return
()
=>
(
openBlock
(),
createElementBlock
(
'
uni-
'
+
name
,
null
,
name
+
'
is unsupported
'
)
)
},
})
}
packages/uni-components/src/index.ts
浏览文件 @
f96cfa22
...
@@ -20,6 +20,7 @@ export { useTouchtrack } from './helpers/useTouchtrack'
...
@@ -20,6 +20,7 @@ export { useTouchtrack } from './helpers/useTouchtrack'
export
{
export
{
defineBuiltInComponent
,
defineBuiltInComponent
,
defineSystemComponent
,
defineSystemComponent
,
defineUnsupportedComponent
,
}
from
'
./helpers/component
'
}
from
'
./helpers/component
'
export
{
flatVNode
}
from
'
./helpers/flatVNode
'
export
{
flatVNode
}
from
'
./helpers/flatVNode
'
export
{
uniFormKey
}
from
'
./components/form
'
export
{
uniFormKey
}
from
'
./components/form
'
...
...
packages/uni-h5-vite/src/plugin/esbuild/esbuildPrePlugin.ts
0 → 100644
浏览文件 @
f96cfa22
import
fs
from
'
fs
'
import
path
from
'
path
'
import
{
Loader
,
Plugin
}
from
'
esbuild
'
import
{
preJs
}
from
'
@dcloudio/uni-cli-shared
'
export
const
JS_TYPES_RE
=
/
\.(?:
j|t
)
sx
?
$|
\.
mjs$/
export
function
esbuildPrePlugin
():
Plugin
{
return
{
name
:
'
vite:dep-scan
'
,
setup
(
build
)
{
build
.
onLoad
({
filter
:
JS_TYPES_RE
},
({
path
:
id
})
=>
{
let
ext
=
path
.
extname
(
id
).
slice
(
1
)
if
(
ext
===
'
mjs
'
)
ext
=
'
js
'
let
contents
=
fs
.
readFileSync
(
id
,
'
utf-8
'
)
if
(
contents
.
includes
(
'
#endif
'
))
{
contents
=
preJs
(
contents
)
}
return
{
loader
:
ext
as
Loader
,
contents
,
}
})
},
}
}
packages/uni-h5-vite/src/plugin/index.ts
浏览文件 @
f96cfa22
import
fs
from
'
fs
'
import
fs
from
'
fs
'
import
path
from
'
path
'
import
path
from
'
path
'
import
{
isInHBuilderX
,
UniVitePlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
{
isInHBuilderX
,
resolveMainPathOnce
,
UniVitePlugin
,
}
from
'
@dcloudio/uni-cli-shared
'
import
{
createHandleHotUpdate
}
from
'
./handleHotUpdate
'
import
{
createHandleHotUpdate
}
from
'
./handleHotUpdate
'
import
{
createTransformIndexHtml
}
from
'
./transformIndexHtml
'
import
{
createTransformIndexHtml
}
from
'
./transformIndexHtml
'
import
{
createDefine
}
from
'
../utils/features
'
import
{
createDefine
}
from
'
../utils/features
'
import
{
isSsr
}
from
'
../utils
'
import
{
isSsr
}
from
'
../utils
'
import
{
ViteDevServer
}
from
'
vite
'
import
{
ViteDevServer
}
from
'
vite
'
import
{
esbuildPrePlugin
}
from
'
./esbuild/esbuildPrePlugin
'
const
external
=
[
const
external
=
[
'
@dcloudio/uni-app
'
,
'
@dcloudio/uni-app
'
,
...
@@ -43,7 +48,11 @@ export const UniH5Plugin: UniVitePlugin = {
...
@@ -43,7 +48,11 @@ export const UniH5Plugin: UniVitePlugin = {
}
}
return
{
return
{
optimizeDeps
:
{
optimizeDeps
:
{
exclude
:
[
'
@dcloudio/uni-h5
'
,
'
@dcloudio/uni-h5-vue
'
],
entries
:
resolveMainPathOnce
(
process
.
env
.
UNI_INPUT_DIR
),
exclude
:
external
,
esbuildOptions
:
{
plugins
:
[
esbuildPrePlugin
()],
},
},
},
define
:
createDefine
(
env
.
command
,
config
),
define
:
createDefine
(
env
.
command
,
config
),
server
:
{
server
:
{
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
f96cfa22
...
@@ -605,6 +605,14 @@ const defineSystemComponent = (options) => {
...
@@ -605,6 +605,14 @@ const defineSystemComponent = (options) => {
};
};
return
vue
.
defineComponent
(
options
);
return
vue
.
defineComponent
(
options
);
};
};
const
defineUnsupportedComponent
=
(
name
)
=>
{
return
defineBuiltInComponent
({
name
:
shared
.
capitalize
(
shared
.
camelize
(
name
)),
setup
()
{
return
()
=>
(
vue
.
openBlock
(),
vue
.
createElementBlock
(
"
uni-
"
+
name
,
null
,
name
+
"
is unsupported
"
));
}
});
};
const
hoverProps
=
{
const
hoverProps
=
{
hoverClass
:
{
hoverClass
:
{
type
:
String
,
type
:
String
,
...
@@ -714,7 +722,7 @@ function normalizeCustomEvent(name, domEvt, el, detail) {
...
@@ -714,7 +722,7 @@ function normalizeCustomEvent(name, domEvt, el, detail) {
};
};
}
}
const
uniFormKey
=
PolySymbol
(
process
.
env
.
NODE_ENV
!==
"
production
"
?
"
uniForm
"
:
"
uf
"
);
const
uniFormKey
=
PolySymbol
(
process
.
env
.
NODE_ENV
!==
"
production
"
?
"
uniForm
"
:
"
uf
"
);
var
index$
y
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
E
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Form
"
,
name
:
"
Form
"
,
emits
:
[
"
submit
"
,
"
reset
"
],
emits
:
[
"
submit
"
,
"
reset
"
],
setup
(
_props
,
{
setup
(
_props
,
{
...
@@ -762,7 +770,7 @@ const props$v = {
...
@@ -762,7 +770,7 @@ const props$v = {
default
:
""
default
:
""
}
}
};
};
var
index$
x
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
D
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Label
"
,
name
:
"
Label
"
,
props
:
props$v
,
props
:
props$v
,
setup
(
props2
,
{
setup
(
props2
,
{
...
@@ -806,7 +814,7 @@ function useProvideLabel() {
...
@@ -806,7 +814,7 @@ function useProvideLabel() {
});
});
return
handlers
;
return
handlers
;
}
}
var
index$
w
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
C
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Button
"
,
name
:
"
Button
"
,
props
:
{
props
:
{
id
:
{
id
:
{
...
@@ -1652,7 +1660,7 @@ const props$u = {
...
@@ -1652,7 +1660,7 @@ const props$u = {
default
:
false
default
:
false
}
}
};
};
var
index$
v
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
B
=
/* @__PURE__ */
defineBuiltInComponent
({
inheritAttrs
:
false
,
inheritAttrs
:
false
,
name
:
"
Canvas
"
,
name
:
"
Canvas
"
,
compatConfig
:
{
compatConfig
:
{
...
@@ -2118,7 +2126,7 @@ const props$t = {
...
@@ -2118,7 +2126,7 @@ const props$t = {
default
:
""
default
:
""
}
}
};
};
var
index$
u
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
A
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
CheckboxGroup
"
,
name
:
"
CheckboxGroup
"
,
props
:
props$t
,
props
:
props$t
,
emits
:
[
"
change
"
],
emits
:
[
"
change
"
],
...
@@ -2194,7 +2202,7 @@ const props$s = {
...
@@ -2194,7 +2202,7 @@ const props$s = {
default
:
""
default
:
""
}
}
};
};
var
index$
t
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
z
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Checkbox
"
,
name
:
"
Checkbox
"
,
props
:
props$s
,
props
:
props$s
,
setup
(
props2
,
{
setup
(
props2
,
{
...
@@ -2463,7 +2471,7 @@ const props$q = /* @__PURE__ */ shared.extend({}, props$r, {
...
@@ -2463,7 +2471,7 @@ const props$q = /* @__PURE__ */ shared.extend({}, props$r, {
default
:
false
default
:
false
}
}
});
});
var
index$
s
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
y
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Editor
"
,
name
:
"
Editor
"
,
props
:
props$q
,
props
:
props$q
,
emit
:
[
"
ready
"
,
"
focus
"
,
"
blur
"
,
"
input
"
,
"
statuschange
"
,
...
emit$1
],
emit
:
[
"
ready
"
,
"
focus
"
,
"
blur
"
,
"
input
"
,
"
statuschange
"
,
...
emit$1
],
...
@@ -2524,7 +2532,7 @@ const ICONS = {
...
@@ -2524,7 +2532,7 @@ const ICONS = {
c
:
GREY_COLOR
c
:
GREY_COLOR
}
}
};
};
var
index$
r
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
x
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Icon
"
,
name
:
"
Icon
"
,
props
:
{
props
:
{
type
:
{
type
:
{
...
@@ -2588,7 +2596,7 @@ const IMAGE_MODES = {
...
@@ -2588,7 +2596,7 @@ const IMAGE_MODES = {
"
bottom left
"
:
[
"
left bottom
"
],
"
bottom left
"
:
[
"
left bottom
"
],
"
bottom right
"
:
[
"
right bottom
"
]
"
bottom right
"
:
[
"
right bottom
"
]
};
};
var
index$
q
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
w
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Image
"
,
name
:
"
Image
"
,
props
:
props$p
,
props
:
props$p
,
setup
(
props2
,
{
setup
(
props2
,
{
...
@@ -3291,7 +3299,7 @@ const props$m = {
...
@@ -3291,7 +3299,7 @@ const props$m = {
default
:
false
default
:
false
}
}
};
};
var
index$
p
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
v
=
/* @__PURE__ */
defineBuiltInComponent
({
inheritAttrs
:
false
,
inheritAttrs
:
false
,
name
:
"
MovableArea
"
,
name
:
"
MovableArea
"
,
props
:
props$m
,
props
:
props$m
,
...
@@ -3836,7 +3844,7 @@ const props$l = {
...
@@ -3836,7 +3844,7 @@ const props$l = {
default
:
true
default
:
true
}
}
};
};
var
index$
o
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
u
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
MovableView
"
,
name
:
"
MovableView
"
,
props
:
props$l
,
props
:
props$l
,
emits
:
[
"
change
"
,
"
scale
"
],
emits
:
[
"
change
"
,
"
scale
"
],
...
@@ -4247,7 +4255,7 @@ const props$k = {
...
@@ -4247,7 +4255,7 @@ const props$k = {
default
:
false
default
:
false
}
}
};
};
var
index$
n
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
t
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Navigator
"
,
name
:
"
Navigator
"
,
compatConfig
:
{
compatConfig
:
{
MODE
:
3
MODE
:
3
...
@@ -4576,7 +4584,7 @@ const props$i = {
...
@@ -4576,7 +4584,7 @@ const props$i = {
}
}
}
}
};
};
var
index$
m
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
s
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Progress
"
,
name
:
"
Progress
"
,
props
:
props$i
,
props
:
props$i
,
setup
(
props2
)
{
setup
(
props2
)
{
...
@@ -4655,7 +4663,7 @@ const props$h = {
...
@@ -4655,7 +4663,7 @@ const props$h = {
default
:
""
default
:
""
}
}
};
};
var
index$
l
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
r
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
RadioGroup
"
,
name
:
"
RadioGroup
"
,
props
:
props$h
,
props
:
props$h
,
setup
(
props2
,
{
setup
(
props2
,
{
...
@@ -4756,7 +4764,7 @@ const props$g = {
...
@@ -4756,7 +4764,7 @@ const props$g = {
default
:
""
default
:
""
}
}
};
};
var
index$
k
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
q
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Radio
"
,
name
:
"
Radio
"
,
props
:
props$g
,
props
:
props$g
,
setup
(
props2
,
{
setup
(
props2
,
{
...
@@ -5050,7 +5058,7 @@ const props$f = {
...
@@ -5050,7 +5058,7 @@ const props$f = {
}
}
}
}
};
};
var
index$
j
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
p
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
RichText
"
,
name
:
"
RichText
"
,
compatConfig
:
{
compatConfig
:
{
MODE
:
3
MODE
:
3
...
@@ -5135,7 +5143,7 @@ const props$e = {
...
@@ -5135,7 +5143,7 @@ const props$e = {
default
:
false
default
:
false
}
}
};
};
var
index$
i
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
o
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
ScrollView
"
,
name
:
"
ScrollView
"
,
compatConfig
:
{
compatConfig
:
{
MODE
:
3
MODE
:
3
...
@@ -5462,7 +5470,7 @@ const props$d = {
...
@@ -5462,7 +5470,7 @@ const props$d = {
default
:
false
default
:
false
}
}
};
};
var
index$
h
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
n
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Slider
"
,
name
:
"
Slider
"
,
props
:
props$d
,
props
:
props$d
,
emits
:
[
"
changing
"
,
"
change
"
],
emits
:
[
"
changing
"
,
"
change
"
],
...
@@ -5999,7 +6007,7 @@ function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger)
...
@@ -5999,7 +6007,7 @@ function useLayout(props2, state, swiperContexts, slideFrameRef, emit2, trigger)
onSwiperDotClick
onSwiperDotClick
};
};
}
}
var
index$
g
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
m
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Swiper
"
,
name
:
"
Swiper
"
,
props
:
props$c
,
props
:
props$c
,
emits
:
[
"
change
"
,
"
transition
"
,
"
animationfinish
"
,
"
update:current
"
,
"
update:currentItemId
"
],
emits
:
[
"
change
"
,
"
transition
"
,
"
animationfinish
"
,
"
update:current
"
,
"
update:currentItemId
"
],
...
@@ -6105,7 +6113,7 @@ const props$b = {
...
@@ -6105,7 +6113,7 @@ const props$b = {
default
:
""
default
:
""
}
}
};
};
var
index$
f
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
l
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
SwiperItem
"
,
name
:
"
SwiperItem
"
,
props
:
props$b
,
props
:
props$b
,
setup
(
props2
,
{
setup
(
props2
,
{
...
@@ -6150,7 +6158,7 @@ const props$a = {
...
@@ -6150,7 +6158,7 @@ const props$a = {
default
:
"
#007aff
"
default
:
"
#007aff
"
}
}
};
};
var
index$
e
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
k
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Switch
"
,
name
:
"
Switch
"
,
props
:
props$a
,
props
:
props$a
,
emits
:
[
"
change
"
],
emits
:
[
"
change
"
],
...
@@ -6245,7 +6253,7 @@ function normalizeText(text, { space, decode }) {
...
@@ -6245,7 +6253,7 @@ function normalizeText(text, { space, decode }) {
}
}
return
text
.
replace
(
/ /g
,
SPACE_UNICODE
.
nbsp
).
replace
(
/ /g
,
SPACE_UNICODE
.
ensp
).
replace
(
/ /g
,
SPACE_UNICODE
.
emsp
).
replace
(
/</g
,
"
<
"
).
replace
(
/>/g
,
"
>
"
).
replace
(
/&/g
,
"
&
"
).
replace
(
/"/g
,
'
"
'
).
replace
(
/'/g
,
"
'
"
);
return
text
.
replace
(
/ /g
,
SPACE_UNICODE
.
nbsp
).
replace
(
/ /g
,
SPACE_UNICODE
.
ensp
).
replace
(
/ /g
,
SPACE_UNICODE
.
emsp
).
replace
(
/</g
,
"
<
"
).
replace
(
/>/g
,
"
>
"
).
replace
(
/&/g
,
"
&
"
).
replace
(
/"/g
,
'
"
'
).
replace
(
/'/g
,
"
'
"
);
}
}
var
index$
d
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
j
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Text
"
,
name
:
"
Text
"
,
props
:
{
props
:
{
selectable
:
{
selectable
:
{
...
@@ -6313,7 +6321,7 @@ const props$9 = /* @__PURE__ */ shared.extend({}, props$o, {
...
@@ -6313,7 +6321,7 @@ const props$9 = /* @__PURE__ */ shared.extend({}, props$o, {
}
}
});
});
let
fixMargin
=
false
;
let
fixMargin
=
false
;
var
index$
c
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
i
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Textarea
"
,
name
:
"
Textarea
"
,
props
:
props$9
,
props
:
props$9
,
emit
:
[
"
confirm
"
,
"
linechange
"
,
...
emit
],
emit
:
[
"
confirm
"
,
"
linechange
"
,
...
emit
],
...
@@ -6431,7 +6439,7 @@ var index$c = /* @__PURE__ */ defineBuiltInComponent({
...
@@ -6431,7 +6439,7 @@ var index$c = /* @__PURE__ */ defineBuiltInComponent({
};
};
}
}
});
});
var
index$
b
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
h
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
View
"
,
name
:
"
View
"
,
props
:
shared
.
extend
({},
hoverProps
),
props
:
shared
.
extend
({},
hoverProps
),
setup
(
props2
,
{
setup
(
props2
,
{
...
@@ -6456,13 +6464,13 @@ function useSubscribe(callback, name, multiple, pageId) {
...
@@ -6456,13 +6464,13 @@ function useSubscribe(callback, name, multiple, pageId) {
const
instance
=
vue
.
getCurrentInstance
();
const
instance
=
vue
.
getCurrentInstance
();
instance
.
proxy
;
instance
.
proxy
;
}
}
let
index$
a
=
0
;
let
index$
g
=
0
;
function
useContextInfo
(
_id
)
{
function
useContextInfo
(
_id
)
{
useCurrentPageId
();
useCurrentPageId
();
const
instance
=
vue
.
getCurrentInstance
();
const
instance
=
vue
.
getCurrentInstance
();
const
vm
=
instance
.
proxy
;
const
vm
=
instance
.
proxy
;
const
type
=
vm
.
$options
.
name
.
toLowerCase
();
const
type
=
vm
.
$options
.
name
.
toLowerCase
();
const
id
=
_id
||
vm
.
id
||
`context
${
index$
a
++
}
`
;
const
id
=
_id
||
vm
.
id
||
`context
${
index$
g
++
}
`
;
return
`
${
type
}
.
${
id
}
`
;
return
`
${
type
}
.
${
id
}
`
;
}
}
function
injectLifecycleHook
(
name
,
hook
,
publicThis
,
instance
)
{
function
injectLifecycleHook
(
name
,
hook
,
publicThis
,
instance
)
{
...
@@ -6760,7 +6768,7 @@ function initHistory() {
...
@@ -6760,7 +6768,7 @@ function initHistory() {
return
vueRouter
.
createMemoryHistory
(
base
);
return
vueRouter
.
createMemoryHistory
(
base
);
}
}
}
}
var
index$
9
=
{
var
index$
f
=
{
install
(
app
)
{
install
(
app
)
{
initApp$1
(
app
);
initApp$1
(
app
);
if
(
__UNI_FEATURE_PAGES__
)
{
if
(
__UNI_FEATURE_PAGES__
)
{
...
@@ -7388,7 +7396,7 @@ const props$8 = {
...
@@ -7388,7 +7396,7 @@ const props$8 = {
default
:
true
default
:
true
}
}
};
};
var
index$
8
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
e
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Video
"
,
name
:
"
Video
"
,
props
:
props$8
,
props
:
props$8
,
emits
:
[
"
fullscreenchange
"
,
"
progress
"
,
"
loadedmetadata
"
,
"
waiting
"
,
"
error
"
,
"
play
"
,
"
pause
"
,
"
ended
"
,
"
timeupdate
"
],
emits
:
[
"
fullscreenchange
"
,
"
progress
"
,
"
loadedmetadata
"
,
"
waiting
"
,
"
error
"
,
"
play
"
,
"
pause
"
,
"
ended
"
,
"
timeupdate
"
],
...
@@ -7617,7 +7625,7 @@ const props$7 = {
...
@@ -7617,7 +7625,7 @@ const props$7 = {
default
:
""
default
:
""
}
}
};
};
var
index$
7
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
d
=
/* @__PURE__ */
defineBuiltInComponent
({
inheritAttrs
:
false
,
inheritAttrs
:
false
,
name
:
"
WebView
"
,
name
:
"
WebView
"
,
props
:
props$7
,
props
:
props$7
,
...
@@ -8384,7 +8392,7 @@ function useMap(props2, rootRef, emit2) {
...
@@ -8384,7 +8392,7 @@ function useMap(props2, rootRef, emit2) {
mapRef
mapRef
};
};
}
}
var
index$
6
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
c
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Map
"
,
name
:
"
Map
"
,
props
:
props$2
,
props
:
props$2
,
emits
:
[
"
markertap
"
,
"
labeltap
"
,
"
callouttap
"
,
"
controltap
"
,
"
regionchange
"
,
"
tap
"
,
"
click
"
,
"
updated
"
,
"
update:scale
"
,
"
update:latitude
"
,
"
update:longitude
"
],
emits
:
[
"
markertap
"
,
"
labeltap
"
,
"
callouttap
"
,
"
controltap
"
,
"
regionchange
"
,
"
tap
"
,
"
click
"
,
"
updated
"
,
"
update:scale
"
,
"
update:latitude
"
,
"
update:longitude
"
],
...
@@ -8417,7 +8425,7 @@ const props$1 = {
...
@@ -8417,7 +8425,7 @@ const props$1 = {
default
:
0
default
:
0
}
}
};
};
var
index$
5
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
b
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
CoverView
"
,
name
:
"
CoverView
"
,
compatConfig
:
{
compatConfig
:
{
MODE
:
3
MODE
:
3
...
@@ -8455,7 +8463,7 @@ var index$5 = /* @__PURE__ */ defineBuiltInComponent({
...
@@ -8455,7 +8463,7 @@ var index$5 = /* @__PURE__ */ defineBuiltInComponent({
};
};
}
}
});
});
var
index$
4
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
a
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
CoverImage
"
,
name
:
"
CoverImage
"
,
compatConfig
:
{
compatConfig
:
{
MODE
:
3
MODE
:
3
...
@@ -8702,7 +8710,7 @@ const props = {
...
@@ -8702,7 +8710,7 @@ const props = {
default
:
""
default
:
""
}
}
};
};
var
index$
3
=
/* @__PURE__ */
defineBuiltInComponent
({
var
index$
9
=
/* @__PURE__ */
defineBuiltInComponent
({
name
:
"
Picker
"
,
name
:
"
Picker
"
,
compatConfig
:
{
compatConfig
:
{
MODE
:
3
MODE
:
3
...
@@ -9296,6 +9304,12 @@ function usePickerForm(_resetFormData, _getFormData) {
...
@@ -9296,6 +9304,12 @@ function usePickerForm(_resetFormData, _getFormData) {
uniForm
.
addField
(
field
);
uniForm
.
addField
(
field
);
}
}
}
}
var
index$8
=
/* @__PURE__ */
defineUnsupportedComponent
(
"
ad
"
);
var
index$7
=
/* @__PURE__ */
defineUnsupportedComponent
(
"
ad-content-page
"
);
var
index$6
=
/* @__PURE__ */
defineUnsupportedComponent
(
"
ad-draw
"
);
var
index$5
=
/* @__PURE__ */
defineUnsupportedComponent
(
"
camera
"
);
var
index$4
=
/* @__PURE__ */
defineUnsupportedComponent
(
"
live-player
"
);
var
index$3
=
/* @__PURE__ */
defineUnsupportedComponent
(
"
live-pusher
"
);
const
UniViewJSBridge$1
=
/* @__PURE__ */
shared
.
extend
(
ViewJSBridge
,
{
const
UniViewJSBridge$1
=
/* @__PURE__ */
shared
.
extend
(
ViewJSBridge
,
{
publishHandler
(
event
,
args
,
pageId
)
{
publishHandler
(
event
,
args
,
pageId
)
{
UniServiceJSBridge
.
subscribeHandler
(
event
,
args
,
pageId
);
UniServiceJSBridge
.
subscribeHandler
(
event
,
args
,
pageId
);
...
@@ -10661,46 +10675,52 @@ var index = /* @__PURE__ */ defineSystemComponent({
...
@@ -10661,46 +10675,52 @@ var index = /* @__PURE__ */ defineSystemComponent({
return
vue
.
openBlock
(),
vue
.
createBlock
(
"
div
"
,
clazz
,
[
loadingVNode
]);
return
vue
.
openBlock
(),
vue
.
createBlock
(
"
div
"
,
clazz
,
[
loadingVNode
]);
}
}
});
});
exports
.
Ad
=
index$8
;
exports
.
AdContentPage
=
index$7
;
exports
.
AdDraw
=
index$6
;
exports
.
AsyncErrorComponent
=
index$1
;
exports
.
AsyncErrorComponent
=
index$1
;
exports
.
AsyncLoadingComponent
=
index
;
exports
.
AsyncLoadingComponent
=
index
;
exports
.
Button
=
index$w
;
exports
.
Button
=
index$C
;
exports
.
Canvas
=
index$v
;
exports
.
Camera
=
index$5
;
exports
.
Checkbox
=
index$t
;
exports
.
Canvas
=
index$B
;
exports
.
CheckboxGroup
=
index$u
;
exports
.
Checkbox
=
index$z
;
exports
.
CoverImage
=
index$4
;
exports
.
CheckboxGroup
=
index$A
;
exports
.
CoverView
=
index$5
;
exports
.
CoverImage
=
index$a
;
exports
.
Editor
=
index$s
;
exports
.
CoverView
=
index$b
;
exports
.
Form
=
index$y
;
exports
.
Editor
=
index$y
;
exports
.
Icon
=
index$r
;
exports
.
Form
=
index$E
;
exports
.
Image
=
index$q
;
exports
.
Icon
=
index$x
;
exports
.
Image
=
index$w
;
exports
.
Input
=
Input
;
exports
.
Input
=
Input
;
exports
.
Label
=
index$
x
;
exports
.
Label
=
index$
D
;
exports
.
LayoutComponent
=
LayoutComponent
;
exports
.
LayoutComponent
=
LayoutComponent
;
exports
.
Map
=
index$6
;
exports
.
LivePlayer
=
index$4
;
exports
.
MovableArea
=
index$p
;
exports
.
LivePusher
=
index$3
;
exports
.
MovableView
=
index$o
;
exports
.
Map
=
index$c
;
exports
.
Navigator
=
index$n
;
exports
.
MovableArea
=
index$v
;
exports
.
MovableView
=
index$u
;
exports
.
Navigator
=
index$t
;
exports
.
PageComponent
=
index$2
;
exports
.
PageComponent
=
index$2
;
exports
.
Picker
=
index$
3
;
exports
.
Picker
=
index$
9
;
exports
.
PickerView
=
PickerView
;
exports
.
PickerView
=
PickerView
;
exports
.
PickerViewColumn
=
PickerViewColumn
;
exports
.
PickerViewColumn
=
PickerViewColumn
;
exports
.
Progress
=
index$
m
;
exports
.
Progress
=
index$
s
;
exports
.
Radio
=
index$
k
;
exports
.
Radio
=
index$
q
;
exports
.
RadioGroup
=
index$
l
;
exports
.
RadioGroup
=
index$
r
;
exports
.
ResizeSensor
=
ResizeSensor
;
exports
.
ResizeSensor
=
ResizeSensor
;
exports
.
RichText
=
index$
j
;
exports
.
RichText
=
index$
p
;
exports
.
ScrollView
=
index$
i
;
exports
.
ScrollView
=
index$
o
;
exports
.
Slider
=
index$
h
;
exports
.
Slider
=
index$
n
;
exports
.
Swiper
=
index$
g
;
exports
.
Swiper
=
index$
m
;
exports
.
SwiperItem
=
index$
f
;
exports
.
SwiperItem
=
index$
l
;
exports
.
Switch
=
index$
e
;
exports
.
Switch
=
index$
k
;
exports
.
Text
=
index$
d
;
exports
.
Text
=
index$
j
;
exports
.
Textarea
=
index$
c
;
exports
.
Textarea
=
index$
i
;
exports
.
UniServiceJSBridge
=
UniServiceJSBridge$1
;
exports
.
UniServiceJSBridge
=
UniServiceJSBridge$1
;
exports
.
UniViewJSBridge
=
UniViewJSBridge$1
;
exports
.
UniViewJSBridge
=
UniViewJSBridge$1
;
exports
.
Video
=
index$
8
;
exports
.
Video
=
index$
e
;
exports
.
View
=
index$
b
;
exports
.
View
=
index$
h
;
exports
.
WebView
=
index$
7
;
exports
.
WebView
=
index$
d
;
exports
.
clearStorage
=
clearStorage
;
exports
.
clearStorage
=
clearStorage
;
exports
.
clearStorageSync
=
clearStorageSync
;
exports
.
clearStorageSync
=
clearStorageSync
;
exports
.
getApp
=
getApp$1
;
exports
.
getApp
=
getApp$1
;
...
@@ -10711,7 +10731,7 @@ exports.getStorageInfo = getStorageInfo;
...
@@ -10711,7 +10731,7 @@ exports.getStorageInfo = getStorageInfo;
exports
.
getStorageInfoSync
=
getStorageInfoSync
;
exports
.
getStorageInfoSync
=
getStorageInfoSync
;
exports
.
getStorageSync
=
getStorageSync
;
exports
.
getStorageSync
=
getStorageSync
;
exports
.
getSystemInfoSync
=
getSystemInfoSync
;
exports
.
getSystemInfoSync
=
getSystemInfoSync
;
exports
.
plugin
=
index$
9
;
exports
.
plugin
=
index$
f
;
exports
.
removeStorage
=
removeStorage
;
exports
.
removeStorage
=
removeStorage
;
exports
.
removeStorageSync
=
removeStorageSync
;
exports
.
removeStorageSync
=
removeStorageSync
;
exports
.
request
=
request
;
exports
.
request
=
request
;
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
f96cfa22
import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent,
provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, createTextVNode, onBeforeActivate, onBeforeDeactivate, openBlock, createBlock, renderList, onDeactivated, createApp, Transition, withCtx, KeepAlive, resolveDynamicComponent, createElementBlock
, createElementVNode, normalizeStyle, renderSlot } from "vue";
import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent,
openBlock, createElementBlock, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, createTextVNode, onBeforeActivate, onBeforeDeactivate, createBlock, renderList, onDeactivated, createApp, Transition, withCtx, KeepAlive, resolveDynamicComponent
, createElementVNode, normalizeStyle, renderSlot } from "vue";
import { isString, extend, stringifyStyle, parseStringStyle, isPlainObject, isFunction,
isArray, hasOwn, isObject, capitalize
, toRawType, makeMap as makeMap$1, isPromise, hyphenate, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared";
import { isString, extend, stringifyStyle, parseStringStyle, isPlainObject, isFunction,
capitalize, camelize, isArray, hasOwn, isObject
, toRawType, makeMap as makeMap$1, isPromise, hyphenate, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared";
import { I18N_JSON_DELIMITERS, once, passive, initCustomDataset, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, UniLifecycleHooks, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { I18N_JSON_DELIMITERS, once, passive, initCustomDataset, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, UniLifecycleHooks, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { initVueI18n, isI18nStr, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n";
import { initVueI18n, isI18nStr, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n";
import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
...
@@ -1538,6 +1538,14 @@ const defineSystemComponent = (options) => {
...
@@ -1538,6 +1538,14 @@ const defineSystemComponent = (options) => {
};
};
return defineComponent(options);
return defineComponent(options);
};
};
const defineUnsupportedComponent = (name) => {
return defineBuiltInComponent({
name: capitalize(camelize(name)),
setup() {
return () => (openBlock(), createElementBlock("uni-" + name, null, name + " is unsupported"));
}
});
};
const hoverProps = {
const hoverProps = {
hoverClass: {
hoverClass: {
type: String,
type: String,
...
@@ -1647,7 +1655,7 @@ function normalizeCustomEvent(name, domEvt, el, detail) {
...
@@ -1647,7 +1655,7 @@ function normalizeCustomEvent(name, domEvt, el, detail) {
};
};
}
}
const uniFormKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniForm" : "uf");
const uniFormKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniForm" : "uf");
var index$
u
= /* @__PURE__ */ defineBuiltInComponent({
var index$
A
= /* @__PURE__ */ defineBuiltInComponent({
name: "Form",
name: "Form",
emits: ["submit", "reset"],
emits: ["submit", "reset"],
setup(_props, {
setup(_props, {
...
@@ -1695,7 +1703,7 @@ const props$C = {
...
@@ -1695,7 +1703,7 @@ const props$C = {
default: ""
default: ""
}
}
};
};
var index$
t
= /* @__PURE__ */ defineBuiltInComponent({
var index$
z
= /* @__PURE__ */ defineBuiltInComponent({
name: "Label",
name: "Label",
props: props$C,
props: props$C,
setup(props2, {
setup(props2, {
...
@@ -1793,7 +1801,7 @@ function _removeListeners(id2, listeners2, watch2) {
...
@@ -1793,7 +1801,7 @@ function _removeListeners(id2, listeners2, watch2) {
}
}
});
});
}
}
var index$
s
= /* @__PURE__ */ defineBuiltInComponent({
var index$
y
= /* @__PURE__ */ defineBuiltInComponent({
name: "Button",
name: "Button",
props: {
props: {
id: {
id: {
...
@@ -4031,13 +4039,13 @@ const createMediaQueryObserver = /* @__PURE__ */ defineSyncApi("createMediaQuery
...
@@ -4031,13 +4039,13 @@ const createMediaQueryObserver = /* @__PURE__ */ defineSyncApi("createMediaQuery
}
}
return new ServiceMediaQueryObserver(getCurrentPageVm());
return new ServiceMediaQueryObserver(getCurrentPageVm());
});
});
let index$
r
= 0;
let index$
x
= 0;
let optionsCache = {};
let optionsCache = {};
function operateEditor(componentId, pageId, type, options) {
function operateEditor(componentId, pageId, type, options) {
const data = { options };
const data = { options };
const needCallOptions = options && ("success" in options || "fail" in options || "complete" in options);
const needCallOptions = options && ("success" in options || "fail" in options || "complete" in options);
if (needCallOptions) {
if (needCallOptions) {
const callbackId = String(index$
r
++);
const callbackId = String(index$
x
++);
data.callbackId = callbackId;
data.callbackId = callbackId;
optionsCache[callbackId] = options;
optionsCache[callbackId] = options;
}
}
...
@@ -6197,7 +6205,7 @@ const props$B = {
...
@@ -6197,7 +6205,7 @@ const props$B = {
default: false
default: false
}
}
};
};
var index$
q
= /* @__PURE__ */ defineBuiltInComponent({
var index$
w
= /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
inheritAttrs: false,
name: "Canvas",
name: "Canvas",
compatConfig: {
compatConfig: {
...
@@ -6666,7 +6674,7 @@ const props$A = {
...
@@ -6666,7 +6674,7 @@ const props$A = {
default: ""
default: ""
}
}
};
};
var index$
p
= /* @__PURE__ */ defineBuiltInComponent({
var index$
v
= /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
name: "CheckboxGroup",
props: props$A,
props: props$A,
emits: ["change"],
emits: ["change"],
...
@@ -6742,7 +6750,7 @@ const props$z = {
...
@@ -6742,7 +6750,7 @@ const props$z = {
default: ""
default: ""
}
}
};
};
var index$
o
= /* @__PURE__ */ defineBuiltInComponent({
var index$
u
= /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
name: "Checkbox",
props: props$z,
props: props$z,
setup(props2, {
setup(props2, {
...
@@ -7605,7 +7613,7 @@ const props$x = /* @__PURE__ */ extend({}, props$y, {
...
@@ -7605,7 +7613,7 @@ const props$x = /* @__PURE__ */ extend({}, props$y, {
default: false
default: false
}
}
});
});
var index$
n
= /* @__PURE__ */ defineBuiltInComponent({
var index$
t
= /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
name: "Editor",
props: props$x,
props: props$x,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
...
@@ -7667,7 +7675,7 @@ const ICONS = {
...
@@ -7667,7 +7675,7 @@ const ICONS = {
c: GREY_COLOR
c: GREY_COLOR
}
}
};
};
var index$
m
= /* @__PURE__ */ defineBuiltInComponent({
var index$
s
= /* @__PURE__ */ defineBuiltInComponent({
name: "Icon",
name: "Icon",
props: {
props: {
type: {
type: {
...
@@ -7731,7 +7739,7 @@ const IMAGE_MODES = {
...
@@ -7731,7 +7739,7 @@ const IMAGE_MODES = {
"bottom left": ["left bottom"],
"bottom left": ["left bottom"],
"bottom right": ["right bottom"]
"bottom right": ["right bottom"]
};
};
var index$
l
= /* @__PURE__ */ defineBuiltInComponent({
var index$
r
= /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
name: "Image",
props: props$w,
props: props$w,
setup(props2, {
setup(props2, {
...
@@ -9795,7 +9803,7 @@ const props$r = {
...
@@ -9795,7 +9803,7 @@ const props$r = {
default: false
default: false
}
}
};
};
var index$
k
= /* @__PURE__ */ defineBuiltInComponent({
var index$
q
= /* @__PURE__ */ defineBuiltInComponent({
name: "Navigator",
name: "Navigator",
compatConfig: {
compatConfig: {
MODE: 3
MODE: 3
...
@@ -10897,7 +10905,7 @@ const props$p = {
...
@@ -10897,7 +10905,7 @@ const props$p = {
}
}
}
}
};
};
var index$
j
= /* @__PURE__ */ defineBuiltInComponent({
var index$
p
= /* @__PURE__ */ defineBuiltInComponent({
name: "Progress",
name: "Progress",
props: props$p,
props: props$p,
setup(props2) {
setup(props2) {
...
@@ -10976,7 +10984,7 @@ const props$o = {
...
@@ -10976,7 +10984,7 @@ const props$o = {
default: ""
default: ""
}
}
};
};
var index$
i
= /* @__PURE__ */ defineBuiltInComponent({
var index$
o
= /* @__PURE__ */ defineBuiltInComponent({
name: "RadioGroup",
name: "RadioGroup",
props: props$o,
props: props$o,
setup(props2, {
setup(props2, {
...
@@ -11083,7 +11091,7 @@ const props$n = {
...
@@ -11083,7 +11091,7 @@ const props$n = {
default: ""
default: ""
}
}
};
};
var index$
h
= /* @__PURE__ */ defineBuiltInComponent({
var index$
n
= /* @__PURE__ */ defineBuiltInComponent({
name: "Radio",
name: "Radio",
props: props$n,
props: props$n,
setup(props2, {
setup(props2, {
...
@@ -11387,7 +11395,7 @@ const props$m = {
...
@@ -11387,7 +11395,7 @@ const props$m = {
}
}
}
}
};
};
var index$
g
= /* @__PURE__ */ defineBuiltInComponent({
var index$
m
= /* @__PURE__ */ defineBuiltInComponent({
name: "RichText",
name: "RichText",
compatConfig: {
compatConfig: {
MODE: 3
MODE: 3
...
@@ -11951,7 +11959,7 @@ const props$k = {
...
@@ -11951,7 +11959,7 @@ const props$k = {
default: false
default: false
}
}
};
};
var index$
f
= /* @__PURE__ */ defineBuiltInComponent({
var index$
l
= /* @__PURE__ */ defineBuiltInComponent({
name: "Slider",
name: "Slider",
props: props$k,
props: props$k,
emits: ["changing", "change"],
emits: ["changing", "change"],
...
@@ -12783,7 +12791,7 @@ const props$h = {
...
@@ -12783,7 +12791,7 @@ const props$h = {
default: "#007aff"
default: "#007aff"
}
}
};
};
var index$
e
= /* @__PURE__ */ defineBuiltInComponent({
var index$
k
= /* @__PURE__ */ defineBuiltInComponent({
name: "Switch",
name: "Switch",
props: props$h,
props: props$h,
emits: ["change"],
emits: ["change"],
...
@@ -12887,7 +12895,7 @@ function normalizeText(text2, { space, decode: decode2 }) {
...
@@ -12887,7 +12895,7 @@ function normalizeText(text2, { space, decode: decode2 }) {
}
}
return text2.replace(/ /g, SPACE_UNICODE.nbsp).replace(/ /g, SPACE_UNICODE.ensp).replace(/ /g, SPACE_UNICODE.emsp).replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
return text2.replace(/ /g, SPACE_UNICODE.nbsp).replace(/ /g, SPACE_UNICODE.ensp).replace(/ /g, SPACE_UNICODE.emsp).replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
}
}
var index$
d
= /* @__PURE__ */ defineBuiltInComponent({
var index$
j
= /* @__PURE__ */ defineBuiltInComponent({
name: "Text",
name: "Text",
props: {
props: {
selectable: {
selectable: {
...
@@ -12959,7 +12967,7 @@ function setFixMargin() {
...
@@ -12959,7 +12967,7 @@ function setFixMargin() {
const DARK_TEST_STRING = "(prefers-color-scheme: dark)";
const DARK_TEST_STRING = "(prefers-color-scheme: dark)";
fixMargin = String(navigator.platform).indexOf("iP") === 0 && String(navigator.vendor).indexOf("Apple") === 0 && window.matchMedia(DARK_TEST_STRING).media !== DARK_TEST_STRING;
fixMargin = String(navigator.platform).indexOf("iP") === 0 && String(navigator.vendor).indexOf("Apple") === 0 && window.matchMedia(DARK_TEST_STRING).media !== DARK_TEST_STRING;
}
}
var index$
c
= /* @__PURE__ */ defineBuiltInComponent({
var index$
i
= /* @__PURE__ */ defineBuiltInComponent({
name: "Textarea",
name: "Textarea",
props: props$g,
props: props$g,
emit: ["confirm", "linechange", ...emit],
emit: ["confirm", "linechange", ...emit],
...
@@ -13080,7 +13088,7 @@ var index$c = /* @__PURE__ */ defineBuiltInComponent({
...
@@ -13080,7 +13088,7 @@ var index$c = /* @__PURE__ */ defineBuiltInComponent({
};
};
}
}
});
});
var index$
b
= /* @__PURE__ */ defineBuiltInComponent({
var index$
h
= /* @__PURE__ */ defineBuiltInComponent({
name: "View",
name: "View",
props: extend({}, hoverProps),
props: extend({}, hoverProps),
setup(props2, {
setup(props2, {
...
@@ -13144,13 +13152,13 @@ function useOn(name, callback) {
...
@@ -13144,13 +13152,13 @@ function useOn(name, callback) {
onMounted(() => UniViewJSBridge.on(name, callback));
onMounted(() => UniViewJSBridge.on(name, callback));
onBeforeUnmount(() => UniViewJSBridge.off(name));
onBeforeUnmount(() => UniViewJSBridge.off(name));
}
}
let index$
a
= 0;
let index$
g
= 0;
function useContextInfo(_id) {
function useContextInfo(_id) {
const page = useCurrentPageId();
const page = useCurrentPageId();
const instance2 = getCurrentInstance();
const instance2 = getCurrentInstance();
const vm = instance2.proxy;
const vm = instance2.proxy;
const type = vm.$options.name.toLowerCase();
const type = vm.$options.name.toLowerCase();
const id2 = _id || vm.id || `context${index$
a
++}`;
const id2 = _id || vm.id || `context${index$
g
++}`;
onMounted(() => {
onMounted(() => {
const el = vm.$el;
const el = vm.$el;
el.__uniContextInfo = {
el.__uniContextInfo = {
...
@@ -13626,7 +13634,7 @@ function initHistory() {
...
@@ -13626,7 +13634,7 @@ function initHistory() {
});
});
return history2;
return history2;
}
}
var index$
9
= {
var index$
f
= {
install(app) {
install(app) {
initApp$1(app);
initApp$1(app);
initViewPlugin(app);
initViewPlugin(app);
...
@@ -14414,7 +14422,7 @@ const props$f = {
...
@@ -14414,7 +14422,7 @@ const props$f = {
default: true
default: true
}
}
};
};
var index$
8
= /* @__PURE__ */ defineBuiltInComponent({
var index$
e
= /* @__PURE__ */ defineBuiltInComponent({
name: "Video",
name: "Video",
props: props$f,
props: props$f,
emits: ["fullscreenchange", "progress", "loadedmetadata", "waiting", "error", "play", "pause", "ended", "timeupdate"],
emits: ["fullscreenchange", "progress", "loadedmetadata", "waiting", "error", "play", "pause", "ended", "timeupdate"],
...
@@ -14643,7 +14651,7 @@ const props$e = {
...
@@ -14643,7 +14651,7 @@ const props$e = {
default: ""
default: ""
}
}
};
};
var index$
7
= /* @__PURE__ */ defineBuiltInComponent({
var index$
d
= /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
inheritAttrs: false,
name: "WebView",
name: "WebView",
props: props$e,
props: props$e,
...
@@ -16251,13 +16259,13 @@ function usePopup(props2, {
...
@@ -16251,13 +16259,13 @@ function usePopup(props2, {
});
});
return visible;
return visible;
}
}
let index$
6
= 0;
let index$
c
= 0;
let overflow = "";
let overflow = "";
function preventScroll(prevent) {
function preventScroll(prevent) {
let before = index$
6
;
let before = index$
c
;
index$
6
+= prevent ? 1 : -1;
index$
c
+= prevent ? 1 : -1;
index$
6 = Math.max(0, index$6
);
index$
c = Math.max(0, index$c
);
if (index$
6
> 0) {
if (index$
c
> 0) {
if (before === 0) {
if (before === 0) {
overflow = document.body.style.overflow;
overflow = document.body.style.overflow;
document.body.style.overflow = "hidden";
document.body.style.overflow = "hidden";
...
@@ -19623,7 +19631,7 @@ const props$1 = {
...
@@ -19623,7 +19631,7 @@ const props$1 = {
default: 0
default: 0
}
}
};
};
var index$
5
= /* @__PURE__ */ defineBuiltInComponent({
var index$
b
= /* @__PURE__ */ defineBuiltInComponent({
name: "CoverView",
name: "CoverView",
compatConfig: {
compatConfig: {
MODE: 3
MODE: 3
...
@@ -19664,7 +19672,7 @@ var index$5 = /* @__PURE__ */ defineBuiltInComponent({
...
@@ -19664,7 +19672,7 @@ var index$5 = /* @__PURE__ */ defineBuiltInComponent({
};
};
}
}
});
});
var index$
4
= /* @__PURE__ */ defineBuiltInComponent({
var index$
a
= /* @__PURE__ */ defineBuiltInComponent({
name: "CoverImage",
name: "CoverImage",
compatConfig: {
compatConfig: {
MODE: 3
MODE: 3
...
@@ -19837,7 +19845,7 @@ const props = {
...
@@ -19837,7 +19845,7 @@ const props = {
default: ""
default: ""
}
}
};
};
var index$
3
= /* @__PURE__ */ defineBuiltInComponent({
var index$
9
= /* @__PURE__ */ defineBuiltInComponent({
name: "Picker",
name: "Picker",
compatConfig: {
compatConfig: {
MODE: 3
MODE: 3
...
@@ -20457,6 +20465,12 @@ function usePickerForm(_resetFormData, _getFormData) {
...
@@ -20457,6 +20465,12 @@ function usePickerForm(_resetFormData, _getFormData) {
});
});
}
}
}
}
var index$8 = /* @__PURE__ */ defineUnsupportedComponent("ad");
var index$7 = /* @__PURE__ */ defineUnsupportedComponent("ad-content-page");
var index$6 = /* @__PURE__ */ defineUnsupportedComponent("ad-draw");
var index$5 = /* @__PURE__ */ defineUnsupportedComponent("camera");
var index$4 = /* @__PURE__ */ defineUnsupportedComponent("live-player");
var index$3 = /* @__PURE__ */ defineUnsupportedComponent("live-pusher");
const UniViewJSBridge$1 = /* @__PURE__ */ extend(ViewJSBridge, {
const UniViewJSBridge$1 = /* @__PURE__ */ extend(ViewJSBridge, {
publishHandler(event, args, pageId) {
publishHandler(event, args, pageId) {
UniServiceJSBridge.subscribeHandler(event, args, pageId);
UniServiceJSBridge.subscribeHandler(event, args, pageId);
...
@@ -21218,4 +21232,4 @@ var index = /* @__PURE__ */ defineSystemComponent({
...
@@ -21218,4 +21232,4 @@ var index = /* @__PURE__ */ defineSystemComponent({
return openBlock(), createBlock("div", clazz, [loadingVNode]);
return openBlock(), createBlock("div", clazz, [loadingVNode]);
}
}
});
});
export { $emit, $off, $on, $once, index$
1 as AsyncErrorComponent, index as AsyncLoadingComponent, index$s as Button, index$q as Canvas, index$o as Checkbox, index$p as CheckboxGroup, index$4 as CoverImage, index$5 as CoverView, index$n as Editor, index$u as Form, index$m as Icon, index$l as Image, Input, index$t as Label, LayoutComponent, Map$1 as Map, MovableArea, MovableView, index$k as Navigator, index$2 as PageComponent, index$3 as Picker, PickerView, PickerViewColumn, index$j as Progress, index$h as Radio, index$i as RadioGroup, ResizeSensor, index$g as RichText, ScrollView, index$f as Slider, Swiper, SwiperItem, index$e as Switch, index$d as Text, index$c as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$8 as Video, index$b as View, index$7 as WebView, addInterceptor, addPhoneContact, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closeSocket, connectSocket, createAnimation$1 as createAnimation, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createLivePlayerContext, createMapContext, createMediaQueryObserver, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getCurrentPages$1 as getCurrentPages, getFileInfo, getImageInfo, getLeftWindowStyle, getLocale, getLocation, getNetworkType, getProvider, getRealPath, getRecorderManager, getRightWindowStyle, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange$1 as getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getTopWindowStyle, getVideoInfo, hideKeyboard, hideLeftWindow, hideLoading, hideNavigationBarLoading, hideRightWindow, hideTabBar, hideTabBarRedDot, hideToast, hideTopWindow, loadFontFace, login, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offCompassChange, offNetworkStatusChange, offWindowResize, onAccelerometerChange, onAppLaunch, onCompassChange, onGyroscopeChange, onLocaleChange, onMemoryWarning, onNetworkStatusChange, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onUserCaptureScreen, onWindowResize, openDocument, openLocation, pageScrollTo, index$9
as plugin, preloadPage, previewImage, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, removeSavedFileInfo, removeStorage, removeStorageSync, removeTabBarBadge, request, saveFile, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, sendSocketMessage, setKeepScreenOn, setLeftWindowStyle, setLocale, setNavigationBarColor, setNavigationBarTitle, setRightWindowStyle, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopWindowStyle, setupApp, setupPage, setupWindow, showActionSheet, showLeftWindow, showLoading, showModal, showNavigationBarLoading, showRightWindow, showTabBar, showTabBarRedDot, showToast, showTopWindow, startAccelerometer, startCompass, startGyroscope, startPullDownRefresh, stopAccelerometer, stopCompass, stopGyroscope, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useI18n, useTabBar, vibrateLong, vibrateShort };
export { $emit, $off, $on, $once, index$
8 as Ad, index$7 as AdContentPage, index$6 as AdDraw, index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, index$y as Button, index$5 as Camera, index$w as Canvas, index$u as Checkbox, index$v as CheckboxGroup, index$a as CoverImage, index$b as CoverView, index$t as Editor, index$A as Form, index$s as Icon, index$r as Image, Input, index$z as Label, LayoutComponent, index$4 as LivePlayer, index$3 as LivePusher, Map$1 as Map, MovableArea, MovableView, index$q as Navigator, index$2 as PageComponent, index$9 as Picker, PickerView, PickerViewColumn, index$p as Progress, index$n as Radio, index$o as RadioGroup, ResizeSensor, index$m as RichText, ScrollView, index$l as Slider, Swiper, SwiperItem, index$k as Switch, index$j as Text, index$i as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$e as Video, index$h as View, index$d as WebView, addInterceptor, addPhoneContact, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closeSocket, connectSocket, createAnimation$1 as createAnimation, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createLivePlayerContext, createMapContext, createMediaQueryObserver, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getCurrentPages$1 as getCurrentPages, getFileInfo, getImageInfo, getLeftWindowStyle, getLocale, getLocation, getNetworkType, getProvider, getRealPath, getRecorderManager, getRightWindowStyle, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange$1 as getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getTopWindowStyle, getVideoInfo, hideKeyboard, hideLeftWindow, hideLoading, hideNavigationBarLoading, hideRightWindow, hideTabBar, hideTabBarRedDot, hideToast, hideTopWindow, loadFontFace, login, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offCompassChange, offNetworkStatusChange, offWindowResize, onAccelerometerChange, onAppLaunch, onCompassChange, onGyroscopeChange, onLocaleChange, onMemoryWarning, onNetworkStatusChange, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onUserCaptureScreen, onWindowResize, openDocument, openLocation, pageScrollTo, index$f
as plugin, preloadPage, previewImage, promiseInterceptor, reLaunch, redirectTo, removeInterceptor, removeSavedFileInfo, removeStorage, removeStorageSync, removeTabBarBadge, request, saveFile, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, sendSocketMessage, setKeepScreenOn, setLeftWindowStyle, setLocale, setNavigationBarColor, setNavigationBarTitle, setRightWindowStyle, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopWindowStyle, setupApp, setupPage, setupWindow, showActionSheet, showLeftWindow, showLoading, showModal, showNavigationBarLoading, showRightWindow, showTabBar, showTabBarRedDot, showToast, showTopWindow, startAccelerometer, startCompass, startGyroscope, startPullDownRefresh, stopAccelerometer, stopCompass, stopGyroscope, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useI18n, useTabBar, vibrateLong, vibrateShort };
packages/uni-h5/src/view/components/ad-content-page/index.tsx
0 → 100644
浏览文件 @
f96cfa22
import
{
defineUnsupportedComponent
}
from
'
@dcloudio/uni-components
'
export
default
/*#__PURE__*/
defineUnsupportedComponent
(
'
ad-content-page
'
)
packages/uni-h5/src/view/components/ad-draw/index.tsx
0 → 100644
浏览文件 @
f96cfa22
import
{
defineUnsupportedComponent
}
from
'
@dcloudio/uni-components
'
export
default
/*#__PURE__*/
defineUnsupportedComponent
(
'
ad-draw
'
)
packages/uni-h5/src/view/components/ad/index.bak.tsx
0 → 100644
浏览文件 @
f96cfa22
import
{
ref
,
Ref
,
watch
,
onMounted
,
onBeforeUnmount
}
from
'
vue
'
import
{
defineBuiltInComponent
,
useAttrs
,
useCustomEvent
,
EmitEvent
,
CustomEventTrigger
,
}
from
'
@dcloudio/uni-components
'
//#region ad
class
AdConfig
{
private
static
_instance
:
AdConfig
static
get
instance
()
{
if
(
!
AdConfig
.
_instance
)
{
AdConfig
.
_instance
=
new
AdConfig
()
AdConfig
.
_instance
.
_init
()
}
return
AdConfig
.
_instance
}
static
IC
=
0
static
IS
=
0
private
_adConfig
:
any
|
null
=
null
private
_isLoading
:
Boolean
=
false
private
_callbacks
:
any
[]
=
[]
private
static
readonly
URL
:
string
=
'
https://hac1.dcloud.net.cn/ah5
'
private
static
readonly
KEY
:
string
=
'
uni_app_ad_config
'
private
static
readonly
CACHE_TIME
:
number
=
1000
*
60
*
10
private
static
readonly
ERROR_INVALID_ADPID
:
any
=
{
'
-5002
'
:
'
invalid adpid
'
,
}
constructor
()
{}
get
adConfig
()
{
return
this
.
_adConfig
}
get
isExpired
()
{
if
(
this
.
_adConfig
==
null
)
{
return
true
}
return
Math
.
abs
(
Date
.
now
()
-
this
.
_adConfig
.
last
)
>
AdConfig
.
CACHE_TIME
}
_init
()
{
var
config
=
this
.
_getConfig
()
if
(
config
===
null
||
!
config
.
last
)
{
return
}
if
(
!
this
.
isExpired
)
{
this
.
_adConfig
=
config
.
data
}
}
get
(
adpid
:
string
,
success
:
Function
,
fail
:
Function
)
{
AdConfig
.
IC
++
if
(
this
.
_adConfig
!=
null
)
{
this
.
_doCallback
(
adpid
,
success
,
fail
)
if
(
this
.
isExpired
)
{
this
.
_loadAdConfig
(
adpid
)
}
return
}
this
.
_callbacks
.
push
({
adpid
:
adpid
,
success
:
success
,
fail
:
fail
,
})
this
.
_loadAdConfig
(
adpid
)
}
_doCallback
(
adpid
:
string
,
success
:
Function
,
fail
:
Function
)
{
AdConfig
.
IS
++
var
{
a
,
b
}
=
this
.
_adConfig
if
(
a
[
adpid
])
{
success
(
b
,
a
[
adpid
])
}
else
{
fail
(
AdConfig
.
ERROR_INVALID_ADPID
)
}
}
_loadAdConfig
(
adpid
:
string
)
{
if
(
this
.
_isLoading
===
true
)
{
return
}
this
.
_isLoading
=
true
uni
.
request
({
url
:
AdConfig
.
URL
,
method
:
'
GET
'
,
timeout
:
8000
,
data
:
{
d
:
location
.
hostname
,
a
:
adpid
,
},
dataType
:
'
json
'
,
success
:
(
res
:
any
)
=>
{
const
rd
=
res
.
data
if
(
rd
.
ret
===
0
)
{
const
data
=
rd
.
data
this
.
_adConfig
=
data
this
.
_setConfig
(
data
)
this
.
_callbacks
.
forEach
(({
adpid
,
success
,
fail
})
=>
{
this
.
_doCallback
(
adpid
,
success
,
fail
)
})
}
else
{
this
.
_callbacks
.
forEach
((
i
)
=>
{
i
.
fail
({
errCode
:
rd
.
ret
,
errMsg
:
rd
.
msg
})
})
}
this
.
_callbacks
=
[]
},
fail
:
(
err
)
=>
{
this
.
_callbacks
.
forEach
((
i
)
=>
{
i
.
fail
(
err
)
})
this
.
_callbacks
=
[]
},
complete
:
(
c
)
=>
{
this
.
_isLoading
=
false
},
})
}
_getConfig
()
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
var
data
=
localStorage
.
getItem
(
AdConfig
.
KEY
)
return
data
?
JSON
.
parse
(
data
)
:
null
}
_setConfig
(
data
:
any
)
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
localStorage
.
setItem
(
AdConfig
.
KEY
,
JSON
.
stringify
({
last
:
Date
.
now
(),
data
:
data
,
})
)
}
}
class
AdReport
{
private
static
_instance
:
AdReport
static
get
instance
()
{
if
(
!
AdReport
.
_instance
)
{
AdReport
.
_instance
=
new
AdReport
()
}
return
AdReport
.
_instance
}
private
static
readonly
URL
:
string
=
'
https://has1.dcloud.net.cn/ahl
'
private
static
readonly
KEY
:
string
=
'
uni_app_ad_guid
'
private
_guid
:
string
constructor
()
{
var
config
=
this
.
_getConfig
()
if
(
config
&&
config
.
guid
)
{
this
.
_guid
=
config
.
guid
return
}
this
.
_guid
=
this
.
_newGUID
()
this
.
_setConfig
(
this
.
_guid
)
}
get
(
data
:
any
)
{
this
.
_process
(
Object
.
assign
(
data
,
{
d
:
location
.
hostname
,
i
:
this
.
_guid
,
})
)
}
_process
(
data
:
any
)
{
uni
.
request
({
url
:
AdReport
.
URL
,
method
:
'
GET
'
,
data
:
data
,
dataType
:
'
json
'
,
success
:
()
=>
{},
})
}
_newGUID
()
{
let
guid
=
''
const
format
=
'
xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx
'
for
(
let
i
=
0
;
i
<
format
.
length
;
i
++
)
{
if
(
format
[
i
]
===
'
x
'
)
{
guid
+=
((
Math
.
random
()
*
16
)
|
0
).
toString
(
16
)
}
else
{
guid
+=
format
[
i
]
}
}
return
guid
.
toUpperCase
()
}
_getConfig
()
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
var
data
=
localStorage
.
getItem
(
AdReport
.
KEY
)
return
data
?
JSON
.
parse
(
data
)
:
null
}
_setConfig
(
guid
:
string
)
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
localStorage
.
setItem
(
AdReport
.
KEY
,
JSON
.
stringify
({
last
:
Date
.
now
(),
guid
:
guid
,
})
)
}
}
class
AdScript
{
private
static
_instance
:
AdScript
static
get
instance
()
{
if
(
!
AdScript
.
_instance
)
{
AdScript
.
_instance
=
new
AdScript
()
}
return
AdScript
.
_instance
}
private
_callback
:
Record
<
string
,
Array
<
any
>>
private
_cache
:
Record
<
string
,
any
>
constructor
()
{
this
.
_callback
=
{}
this
.
_cache
=
{}
}
load
(
data
:
any
,
success
:
Function
,
fail
:
Function
)
{
const
provider
=
data
.
provider
if
(
this
.
_cache
[
provider
]
===
undefined
)
{
this
.
loadScript
(
data
)
}
if
(
this
.
_cache
[
provider
]
===
1
)
{
success
()
}
else
{
if
(
!
this
.
_callback
[
provider
])
{
this
.
_callback
[
provider
]
=
[]
}
this
.
_callback
[
provider
].
push
({
success
,
fail
,
})
}
}
loadScript
(
data
:
any
)
{
const
provider
=
data
.
provider
this
.
_cache
[
provider
]
=
0
var
ads
=
document
.
createElement
(
'
script
'
)
ads
.
setAttribute
(
'
id
'
,
'
uniad_provider
'
+
provider
)
const
script
=
data
.
script
for
(
const
var1
in
script
)
{
ads
.
setAttribute
(
var1
,
script
[
var1
])
}
ads
.
onload
=
()
=>
{
this
.
_cache
[
provider
]
=
1
this
.
_callback
[
provider
].
forEach
(({
success
})
=>
{
success
()
})
this
.
_callback
[
provider
].
length
=
0
}
ads
.
onerror
=
(
err
)
=>
{
this
.
_cache
[
provider
]
=
undefined
this
.
_callback
[
provider
].
forEach
(({
fail
})
=>
{
fail
(
err
)
})
this
.
_callback
[
provider
].
length
=
0
}
document
.
body
.
append
(
ads
)
}
}
const
CHECK_RENDER_DELAY
=
1000
const
CHECK_RENDER_RETRY
=
5
class
AdRender
{
private
_checkTimer
:
number
|
null
private
_pi
:
number
=
0
private
_pl
:
any
[]
=
[]
private
_b
:
any
=
{}
private
_checkTimerCount
:
number
=
0
private
_trigger
:
CustomEventTrigger
private
_adpid
:
string
private
_adpidWidescreen
:
string
private
_widescreenWidth
:
number
private
_currentAdpid
:
string
private
_rootRef
:
any
constructor
(
props
:
{
adpid
:
string
;
adpidWidescreen
:
string
;
widescreenWidth
:
number
},
trigger
:
CustomEventTrigger
,
rootRef
:
Ref
<
HTMLElement
|
null
>
)
{
this
.
_checkTimer
=
null
this
.
_adpid
=
props
.
adpid
this
.
_adpidWidescreen
=
props
.
adpidWidescreen
this
.
_widescreenWidth
=
props
.
widescreenWidth
this
.
_trigger
=
trigger
this
.
_rootRef
=
rootRef
this
.
_currentAdpid
=
this
.
_adpid
}
get
isWidescreen
():
boolean
{
return
this
.
_rootRef
.
value
.
style
.
clientWidth
>
this
.
_widescreenWidth
}
load
(
adpid
:
string
|
null
)
{
this
.
_currentAdpid
=
adpid
||
(
this
.
isWidescreen
?
this
.
_adpidWidescreen
:
this
.
_adpid
)
this
.
_reset
()
AdConfig
.
instance
.
get
(
this
.
_currentAdpid
,
(
b
:
any
,
a
:
Array
<
any
>
)
=>
{
this
.
_b
=
b
this
.
_pl
=
a
this
.
_renderAd
()
},
(
err
:
any
)
=>
{
this
.
_trigger
(
'
error
'
,
{}
as
Event
,
err
)
}
)
}
dispose
()
{
this
.
_clearCheckTimer
()
this
.
_rootRef
.
value
.
innerHTML
=
''
}
_renderAd
()
{
if
(
this
.
_pi
>
this
.
_pl
.
length
-
1
)
{
return
}
const
data
=
this
.
_pl
[
this
.
_pi
]
const
providerId
=
data
.
a1
this
.
_b
[
providerId
].
provider
=
providerId
AdScript
.
instance
.
load
(
this
.
_b
[
providerId
],
()
=>
{
this
.
_renderAdView
(
this
.
_b
[
providerId
],
data
)
},
(
err
:
any
)
=>
{
this
.
_trigger
(
'
error
'
,
{}
as
Event
,
err
)
}
)
}
_renderAdView
(
provider
:
any
,
data
:
any
)
{
var
randomId
=
this
.
_randomId
()
var
adView
=
document
.
createElement
(
'
div
'
)
adView
.
setAttribute
(
'
class
'
,
randomId
)
this
.
_rootRef
.
value
.
innerHTML
=
''
this
.
_rootRef
.
value
.
append
(
adView
)
let
bindThis
=
window
provider
.
s
.
split
(
'
.
'
)
.
reduce
((
total
:
any
,
currentValue
:
any
)
=>
{
bindThis
=
total
return
total
[
currentValue
]
},
window
)
.
bind
(
bindThis
)(
data
.
a2
,
randomId
,
2
)
this
.
_startCheckTimer
()
}
_renderNext
()
{
if
(
this
.
_pi
>=
this
.
_pl
.
length
-
1
)
{
return
}
this
.
_pi
++
this
.
_renderAd
()
}
_checkRender
():
boolean
{
var
hasContent
=
this
.
_rootRef
.
value
.
children
.
length
>
0
&&
this
.
_rootRef
.
value
.
clientHeight
>
40
if
(
hasContent
)
{
this
.
report
(
40
)
}
return
hasContent
}
_startCheckTimer
()
{
this
.
_clearCheckTimer
()
this
.
_checkTimer
=
setInterval
(()
=>
{
this
.
_checkTimerCount
++
if
(
this
.
_checkTimerCount
>=
CHECK_RENDER_RETRY
)
{
this
.
_clearCheckTimer
()
this
.
_renderNext
()
return
}
if
(
this
.
_checkRender
())
{
this
.
_clearCheckTimer
()
}
},
CHECK_RENDER_DELAY
)
}
_clearCheckTimer
()
{
this
.
_checkTimerCount
=
0
if
(
this
.
_checkTimer
!=
null
)
{
window
.
clearInterval
(
this
.
_checkTimer
)
this
.
_checkTimer
=
null
}
}
report
(
type
:
number
)
{
AdReport
.
instance
.
get
({
h
:
(
__uniConfig
as
any
).
compilerVersion
,
// TODO
a
:
this
.
_currentAdpid
,
at
:
type
,
})
}
_randomId
()
{
var
result
=
''
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
result
+=
((
65536
*
(
1
+
Math
.
random
()))
|
0
).
toString
(
16
).
substring
(
1
)
}
return
'
_u
'
+
result
}
_reset
()
{
this
.
_b
=
{}
this
.
_pl
=
[]
this
.
_pi
=
0
this
.
_clearCheckTimer
()
this
.
_rootRef
.
value
.
innerHTML
=
''
}
}
//#endregion
const
DEFAULT_WIDESCREEN_WIDTH
:
number
=
750
export
default
/*#__PURE__*/
defineBuiltInComponent
({
inheritAttrs
:
false
,
name
:
'
Ad
'
,
props
:
{
adpid
:
{
type
:
String
,
default
:
''
,
},
adpidWidescreen
:
{
type
:
String
,
default
:
''
,
},
widescreenWidth
:
{
type
:
Number
,
default
:
DEFAULT_WIDESCREEN_WIDTH
,
},
},
setup
(
props
,
{
emit
})
{
const
rootRef
=
ref
(
null
)
const
{
$excludeAttrs
,
$listeners
}
=
useAttrs
({
excludeListeners
:
true
,
})
const
trigger
=
useCustomEvent
<
EmitEvent
<
typeof
emit
>>
(
rootRef
,
emit
)
const
ad
=
new
AdRender
(
props
,
trigger
,
rootRef
)
watch
(
()
=>
props
.
adpid
,
(
val
)
=>
{
ad
.
load
(
val
)
}
)
onMounted
(()
=>
{
ad
.
load
(
null
)
})
onBeforeUnmount
(()
=>
{
ad
.
dispose
()
})
return
()
=>
{
const
{
adpid
,
adpidWidescreen
,
widescreenWidth
}
=
props
return
(
<>
<
uni
-
ad
{
...
$listeners
.
value
}
{
...
$excludeAttrs
.
value
}
ref
=
{
rootRef
}
adpid
=
{
adpid
}
adpidWidescreen
=
{
adpidWidescreen
}
widescreenWidth
=
{
widescreenWidth
}
></
uni
-
ad
>
</>
)
}
},
})
packages/uni-h5/src/view/components/ad/index.tsx
浏览文件 @
f96cfa22
import
{
ref
,
Ref
,
watch
,
onMounted
,
onBeforeUnmount
}
from
'
vue
'
import
{
defineUnsupportedComponent
}
from
'
@dcloudio/uni-components
'
import
{
defineBuiltInComponent
,
useAttrs
,
useCustomEvent
,
EmitEvent
,
CustomEventTrigger
,
}
from
'
@dcloudio/uni-components
'
//#region ad
export
default
/*#__PURE__*/
defineUnsupportedComponent
(
'
ad
'
)
class
AdConfig
{
private
static
_instance
:
AdConfig
static
get
instance
()
{
if
(
!
AdConfig
.
_instance
)
{
AdConfig
.
_instance
=
new
AdConfig
()
AdConfig
.
_instance
.
_init
()
}
return
AdConfig
.
_instance
}
static
IC
=
0
static
IS
=
0
private
_adConfig
:
any
|
null
=
null
private
_isLoading
:
Boolean
=
false
private
_callbacks
:
any
[]
=
[]
private
static
readonly
URL
:
string
=
'
https://hac1.dcloud.net.cn/ah5
'
private
static
readonly
KEY
:
string
=
'
uni_app_ad_config
'
private
static
readonly
CACHE_TIME
:
number
=
1000
*
60
*
10
private
static
readonly
ERROR_INVALID_ADPID
:
any
=
{
'
-5002
'
:
'
invalid adpid
'
,
}
constructor
()
{}
get
adConfig
()
{
return
this
.
_adConfig
}
get
isExpired
()
{
if
(
this
.
_adConfig
==
null
)
{
return
true
}
return
Math
.
abs
(
Date
.
now
()
-
this
.
_adConfig
.
last
)
>
AdConfig
.
CACHE_TIME
}
_init
()
{
var
config
=
this
.
_getConfig
()
if
(
config
===
null
||
!
config
.
last
)
{
return
}
if
(
!
this
.
isExpired
)
{
this
.
_adConfig
=
config
.
data
}
}
get
(
adpid
:
string
,
success
:
Function
,
fail
:
Function
)
{
AdConfig
.
IC
++
if
(
this
.
_adConfig
!=
null
)
{
this
.
_doCallback
(
adpid
,
success
,
fail
)
if
(
this
.
isExpired
)
{
this
.
_loadAdConfig
(
adpid
)
}
return
}
this
.
_callbacks
.
push
({
adpid
:
adpid
,
success
:
success
,
fail
:
fail
,
})
this
.
_loadAdConfig
(
adpid
)
}
_doCallback
(
adpid
:
string
,
success
:
Function
,
fail
:
Function
)
{
AdConfig
.
IS
++
var
{
a
,
b
}
=
this
.
_adConfig
if
(
a
[
adpid
])
{
success
(
b
,
a
[
adpid
])
}
else
{
fail
(
AdConfig
.
ERROR_INVALID_ADPID
)
}
}
_loadAdConfig
(
adpid
:
string
)
{
if
(
this
.
_isLoading
===
true
)
{
return
}
this
.
_isLoading
=
true
uni
.
request
({
url
:
AdConfig
.
URL
,
method
:
'
GET
'
,
timeout
:
8000
,
data
:
{
d
:
location
.
hostname
,
a
:
adpid
,
},
dataType
:
'
json
'
,
success
:
(
res
:
any
)
=>
{
const
rd
=
res
.
data
if
(
rd
.
ret
===
0
)
{
const
data
=
rd
.
data
this
.
_adConfig
=
data
this
.
_setConfig
(
data
)
this
.
_callbacks
.
forEach
(({
adpid
,
success
,
fail
})
=>
{
this
.
_doCallback
(
adpid
,
success
,
fail
)
})
}
else
{
this
.
_callbacks
.
forEach
((
i
)
=>
{
i
.
fail
({
errCode
:
rd
.
ret
,
errMsg
:
rd
.
msg
})
})
}
this
.
_callbacks
=
[]
},
fail
:
(
err
)
=>
{
this
.
_callbacks
.
forEach
((
i
)
=>
{
i
.
fail
(
err
)
})
this
.
_callbacks
=
[]
},
complete
:
(
c
)
=>
{
this
.
_isLoading
=
false
},
})
}
_getConfig
()
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
var
data
=
localStorage
.
getItem
(
AdConfig
.
KEY
)
return
data
?
JSON
.
parse
(
data
)
:
null
}
_setConfig
(
data
:
any
)
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
localStorage
.
setItem
(
AdConfig
.
KEY
,
JSON
.
stringify
({
last
:
Date
.
now
(),
data
:
data
,
})
)
}
}
class
AdReport
{
private
static
_instance
:
AdReport
static
get
instance
()
{
if
(
!
AdReport
.
_instance
)
{
AdReport
.
_instance
=
new
AdReport
()
}
return
AdReport
.
_instance
}
private
static
readonly
URL
:
string
=
'
https://has1.dcloud.net.cn/ahl
'
private
static
readonly
KEY
:
string
=
'
uni_app_ad_guid
'
private
_guid
:
string
constructor
()
{
var
config
=
this
.
_getConfig
()
if
(
config
&&
config
.
guid
)
{
this
.
_guid
=
config
.
guid
return
}
this
.
_guid
=
this
.
_newGUID
()
this
.
_setConfig
(
this
.
_guid
)
}
get
(
data
:
any
)
{
this
.
_process
(
Object
.
assign
(
data
,
{
d
:
location
.
hostname
,
i
:
this
.
_guid
,
})
)
}
_process
(
data
:
any
)
{
uni
.
request
({
url
:
AdReport
.
URL
,
method
:
'
GET
'
,
data
:
data
,
dataType
:
'
json
'
,
success
:
()
=>
{},
})
}
_newGUID
()
{
let
guid
=
''
const
format
=
'
xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx
'
for
(
let
i
=
0
;
i
<
format
.
length
;
i
++
)
{
if
(
format
[
i
]
===
'
x
'
)
{
guid
+=
((
Math
.
random
()
*
16
)
|
0
).
toString
(
16
)
}
else
{
guid
+=
format
[
i
]
}
}
return
guid
.
toUpperCase
()
}
_getConfig
()
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
var
data
=
localStorage
.
getItem
(
AdReport
.
KEY
)
return
data
?
JSON
.
parse
(
data
)
:
null
}
_setConfig
(
guid
:
string
)
{
if
(
!
navigator
.
cookieEnabled
||
!
window
.
localStorage
)
{
return
null
}
localStorage
.
setItem
(
AdReport
.
KEY
,
JSON
.
stringify
({
last
:
Date
.
now
(),
guid
:
guid
,
})
)
}
}
class
AdScript
{
private
static
_instance
:
AdScript
static
get
instance
()
{
if
(
!
AdScript
.
_instance
)
{
AdScript
.
_instance
=
new
AdScript
()
}
return
AdScript
.
_instance
}
private
_callback
:
Record
<
string
,
Array
<
any
>>
private
_cache
:
Record
<
string
,
any
>
constructor
()
{
this
.
_callback
=
{}
this
.
_cache
=
{}
}
load
(
data
:
any
,
success
:
Function
,
fail
:
Function
)
{
const
provider
=
data
.
provider
if
(
this
.
_cache
[
provider
]
===
undefined
)
{
this
.
loadScript
(
data
)
}
if
(
this
.
_cache
[
provider
]
===
1
)
{
success
()
}
else
{
if
(
!
this
.
_callback
[
provider
])
{
this
.
_callback
[
provider
]
=
[]
}
this
.
_callback
[
provider
].
push
({
success
,
fail
,
})
}
}
loadScript
(
data
:
any
)
{
const
provider
=
data
.
provider
this
.
_cache
[
provider
]
=
0
var
ads
=
document
.
createElement
(
'
script
'
)
ads
.
setAttribute
(
'
id
'
,
'
uniad_provider
'
+
provider
)
const
script
=
data
.
script
for
(
const
var1
in
script
)
{
ads
.
setAttribute
(
var1
,
script
[
var1
])
}
ads
.
onload
=
()
=>
{
this
.
_cache
[
provider
]
=
1
this
.
_callback
[
provider
].
forEach
(({
success
})
=>
{
success
()
})
this
.
_callback
[
provider
].
length
=
0
}
ads
.
onerror
=
(
err
)
=>
{
this
.
_cache
[
provider
]
=
undefined
this
.
_callback
[
provider
].
forEach
(({
fail
})
=>
{
fail
(
err
)
})
this
.
_callback
[
provider
].
length
=
0
}
document
.
body
.
append
(
ads
)
}
}
const
CHECK_RENDER_DELAY
=
1000
const
CHECK_RENDER_RETRY
=
5
class
AdRender
{
private
_checkTimer
:
number
|
null
private
_pi
:
number
=
0
private
_pl
:
any
[]
=
[]
private
_b
:
any
=
{}
private
_checkTimerCount
:
number
=
0
private
_trigger
:
CustomEventTrigger
private
_adpid
:
string
private
_adpidWidescreen
:
string
private
_widescreenWidth
:
number
private
_currentAdpid
:
string
private
_rootRef
:
any
constructor
(
props
:
{
adpid
:
string
;
adpidWidescreen
:
string
;
widescreenWidth
:
number
},
trigger
:
CustomEventTrigger
,
rootRef
:
Ref
<
HTMLElement
|
null
>
)
{
this
.
_checkTimer
=
null
this
.
_adpid
=
props
.
adpid
this
.
_adpidWidescreen
=
props
.
adpidWidescreen
this
.
_widescreenWidth
=
props
.
widescreenWidth
this
.
_trigger
=
trigger
this
.
_rootRef
=
rootRef
this
.
_currentAdpid
=
this
.
_adpid
}
get
isWidescreen
():
boolean
{
return
this
.
_rootRef
.
value
.
style
.
clientWidth
>
this
.
_widescreenWidth
}
load
(
adpid
:
string
|
null
)
{
this
.
_currentAdpid
=
adpid
||
(
this
.
isWidescreen
?
this
.
_adpidWidescreen
:
this
.
_adpid
)
this
.
_reset
()
AdConfig
.
instance
.
get
(
this
.
_currentAdpid
,
(
b
:
any
,
a
:
Array
<
any
>
)
=>
{
this
.
_b
=
b
this
.
_pl
=
a
this
.
_renderAd
()
},
(
err
:
any
)
=>
{
this
.
_trigger
(
'
error
'
,
{}
as
Event
,
err
)
}
)
}
dispose
()
{
this
.
_clearCheckTimer
()
this
.
_rootRef
.
value
.
innerHTML
=
''
}
_renderAd
()
{
if
(
this
.
_pi
>
this
.
_pl
.
length
-
1
)
{
return
}
const
data
=
this
.
_pl
[
this
.
_pi
]
const
providerId
=
data
.
a1
this
.
_b
[
providerId
].
provider
=
providerId
AdScript
.
instance
.
load
(
this
.
_b
[
providerId
],
()
=>
{
this
.
_renderAdView
(
this
.
_b
[
providerId
],
data
)
},
(
err
:
any
)
=>
{
this
.
_trigger
(
'
error
'
,
{}
as
Event
,
err
)
}
)
}
_renderAdView
(
provider
:
any
,
data
:
any
)
{
var
randomId
=
this
.
_randomId
()
var
adView
=
document
.
createElement
(
'
div
'
)
adView
.
setAttribute
(
'
class
'
,
randomId
)
this
.
_rootRef
.
value
.
innerHTML
=
''
this
.
_rootRef
.
value
.
append
(
adView
)
let
bindThis
=
window
provider
.
s
.
split
(
'
.
'
)
.
reduce
((
total
:
any
,
currentValue
:
any
)
=>
{
bindThis
=
total
return
total
[
currentValue
]
},
window
)
.
bind
(
bindThis
)(
data
.
a2
,
randomId
,
2
)
this
.
_startCheckTimer
()
}
_renderNext
()
{
if
(
this
.
_pi
>=
this
.
_pl
.
length
-
1
)
{
return
}
this
.
_pi
++
this
.
_renderAd
()
}
_checkRender
():
boolean
{
var
hasContent
=
this
.
_rootRef
.
value
.
children
.
length
>
0
&&
this
.
_rootRef
.
value
.
clientHeight
>
40
if
(
hasContent
)
{
this
.
report
(
40
)
}
return
hasContent
}
_startCheckTimer
()
{
this
.
_clearCheckTimer
()
this
.
_checkTimer
=
setInterval
(()
=>
{
this
.
_checkTimerCount
++
if
(
this
.
_checkTimerCount
>=
CHECK_RENDER_RETRY
)
{
this
.
_clearCheckTimer
()
this
.
_renderNext
()
return
}
if
(
this
.
_checkRender
())
{
this
.
_clearCheckTimer
()
}
},
CHECK_RENDER_DELAY
)
}
_clearCheckTimer
()
{
this
.
_checkTimerCount
=
0
if
(
this
.
_checkTimer
!=
null
)
{
window
.
clearInterval
(
this
.
_checkTimer
)
this
.
_checkTimer
=
null
}
}
report
(
type
:
number
)
{
AdReport
.
instance
.
get
({
h
:
(
__uniConfig
as
any
).
compilerVersion
,
// TODO
a
:
this
.
_currentAdpid
,
at
:
type
,
})
}
_randomId
()
{
var
result
=
''
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
result
+=
((
65536
*
(
1
+
Math
.
random
()))
|
0
).
toString
(
16
).
substring
(
1
)
}
return
'
_u
'
+
result
}
_reset
()
{
this
.
_b
=
{}
this
.
_pl
=
[]
this
.
_pi
=
0
this
.
_clearCheckTimer
()
this
.
_rootRef
.
value
.
innerHTML
=
''
}
}
//#endregion
const
DEFAULT_WIDESCREEN_WIDTH
:
number
=
750
export
default
/*#__PURE__*/
defineBuiltInComponent
({
inheritAttrs
:
false
,
name
:
'
Ad
'
,
props
:
{
adpid
:
{
type
:
String
,
default
:
''
,
},
adpidWidescreen
:
{
type
:
String
,
default
:
''
,
},
widescreenWidth
:
{
type
:
Number
,
default
:
DEFAULT_WIDESCREEN_WIDTH
,
},
},
setup
(
props
,
{
emit
})
{
const
rootRef
=
ref
(
null
)
const
{
$excludeAttrs
,
$listeners
}
=
useAttrs
({
excludeListeners
:
true
,
})
const
trigger
=
useCustomEvent
<
EmitEvent
<
typeof
emit
>>
(
rootRef
,
emit
)
const
ad
=
new
AdRender
(
props
,
trigger
,
rootRef
)
watch
(
()
=>
props
.
adpid
,
(
val
)
=>
{
ad
.
load
(
val
)
}
)
onMounted
(()
=>
{
ad
.
load
(
null
)
})
onBeforeUnmount
(()
=>
{
ad
.
dispose
()
})
return
()
=>
{
const
{
adpid
,
adpidWidescreen
,
widescreenWidth
}
=
props
return
(
<>
<
uni
-
ad
{
...
$listeners
.
value
}
{
...
$excludeAttrs
.
value
}
ref
=
{
rootRef
}
adpid
=
{
adpid
}
adpidWidescreen
=
{
adpidWidescreen
}
widescreenWidth
=
{
widescreenWidth
}
></
uni
-
ad
>
</>
)
}
},
})
packages/uni-h5/src/view/components/camera/index.tsx
0 → 100644
浏览文件 @
f96cfa22
import
{
defineUnsupportedComponent
}
from
'
@dcloudio/uni-components
'
export
default
/*#__PURE__*/
defineUnsupportedComponent
(
'
camera
'
)
packages/uni-h5/src/view/components/index.ts
浏览文件 @
f96cfa22
...
@@ -5,4 +5,24 @@ import CoverView from './cover-view'
...
@@ -5,4 +5,24 @@ import CoverView from './cover-view'
import
CoverImage
from
'
./cover-image
'
import
CoverImage
from
'
./cover-image
'
import
Picker
from
'
./picker/index
'
import
Picker
from
'
./picker/index
'
export
{
Video
,
WebView
,
Map
,
CoverView
,
CoverImage
,
Picker
}
import
Ad
from
'
./ad/index
'
import
AdContentPage
from
'
./ad-content-page/index
'
import
AdDraw
from
'
./ad-draw/index
'
import
Camera
from
'
./camera/index
'
import
LivePlayer
from
'
./live-player/index
'
import
LivePusher
from
'
./live-pusher/index
'
export
{
Video
,
WebView
,
Map
,
CoverView
,
CoverImage
,
Picker
,
//Unsupported
Ad
,
AdContentPage
,
AdDraw
,
Camera
,
LivePlayer
,
LivePusher
,
}
packages/uni-h5/src/view/components/live-player/index.tsx
0 → 100644
浏览文件 @
f96cfa22
import
{
defineUnsupportedComponent
}
from
'
@dcloudio/uni-components
'
export
default
/*#__PURE__*/
defineUnsupportedComponent
(
'
live-player
'
)
packages/uni-h5/src/view/components/live-pusher/index.tsx
0 → 100644
浏览文件 @
f96cfa22
import
{
defineUnsupportedComponent
}
from
'
@dcloudio/uni-components
'
export
default
/*#__PURE__*/
defineUnsupportedComponent
(
'
live-pusher
'
)
packages/uni-h5/style/ad-content-page.css
0 → 100644
浏览文件 @
f96cfa22
uni-ad-content-page
{
display
:
block
;
overflow
:
hidden
;
}
uni-ad-content-page
[
hidden
]
{
display
:
none
;
}
packages/uni-h5/style/ad-draw.css
0 → 100644
浏览文件 @
f96cfa22
uni-ad-draw
{
display
:
block
;
overflow
:
hidden
;
}
uni-ad-draw
[
hidden
]
{
display
:
none
;
}
packages/uni-h5/style/camera.css
0 → 100644
浏览文件 @
f96cfa22
uni-camera
{
display
:
block
;
overflow
:
hidden
;
}
uni-camera
[
hidden
]
{
display
:
none
;
}
packages/uni-h5/style/live-player.css
0 → 100644
浏览文件 @
f96cfa22
uni-live-player
{
display
:
block
;
overflow
:
hidden
;
}
uni-live-player
[
hidden
]
{
display
:
none
;
}
packages/uni-h5/style/live-pusher.css
0 → 100644
浏览文件 @
f96cfa22
uni-live-pusher
{
display
:
block
;
overflow
:
hidden
;
}
uni-live-pusher
[
hidden
]
{
display
:
none
;
}
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
f96cfa22
...
@@ -6,6 +6,8 @@ var shared = require('@vue/shared');
...
@@ -6,6 +6,8 @@ var shared = require('@vue/shared');
const
BUILT_IN_TAGS
=
[
const
BUILT_IN_TAGS
=
[
'
ad
'
,
'
ad
'
,
'
ad-content-page
'
,
'
ad-draw
'
,
'
audio
'
,
'
audio
'
,
'
button
'
,
'
button
'
,
'
camera
'
,
'
camera
'
,
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
f96cfa22
...
@@ -2,6 +2,8 @@ import { isHTMLTag, isSVGTag, hyphenate, camelize, extend, isString, isPlainObje
...
@@ -2,6 +2,8 @@ import { isHTMLTag, isSVGTag, hyphenate, camelize, extend, isString, isPlainObje
const
BUILT_IN_TAGS
=
[
const
BUILT_IN_TAGS
=
[
'
ad
'
,
'
ad
'
,
'
ad-content-page
'
,
'
ad-draw
'
,
'
audio
'
,
'
audio
'
,
'
button
'
,
'
button
'
,
'
camera
'
,
'
camera
'
,
...
...
packages/uni-shared/src/tags.ts
浏览文件 @
f96cfa22
...
@@ -2,6 +2,8 @@ import { isHTMLTag, isSVGTag } from '@vue/shared'
...
@@ -2,6 +2,8 @@ import { isHTMLTag, isSVGTag } from '@vue/shared'
export
const
BUILT_IN_TAGS
=
[
export
const
BUILT_IN_TAGS
=
[
'
ad
'
,
'
ad
'
,
'
ad-content-page
'
,
'
ad-draw
'
,
'
audio
'
,
'
audio
'
,
'
button
'
,
'
button
'
,
'
camera
'
,
'
camera
'
,
...
...
packages/vite-plugin-uni/src/config/index.ts
浏览文件 @
f96cfa22
...
@@ -33,7 +33,8 @@ export function createConfig(
...
@@ -33,7 +33,8 @@ export function createConfig(
return
{
return
{
base
,
base
,
root
:
process
.
env
.
VITE_ROOT_DIR
,
root
:
process
.
env
.
VITE_ROOT_DIR
,
publicDir
:
config
.
publicDir
||
false
,
// TODO 临时设置为__static__,屏蔽警告:https://github.com/vitejs/vite/blob/824d042535033a5c3d7006978c0d05c201cd1c25/packages/vite/src/node/server/middlewares/transform.ts#L125
publicDir
:
config
.
publicDir
||
'
__static__
'
,
define
:
createDefine
(
options
),
define
:
createDefine
(
options
),
resolve
:
createResolve
(
options
,
config
),
resolve
:
createResolve
(
options
,
config
),
logLevel
:
config
.
logLevel
||
'
warn
'
,
logLevel
:
config
.
logLevel
||
'
warn
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录