Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
e243f654
U
uni-app
项目概览
Velpro187
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e243f654
编写于
5月 20, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: slider props.value watcher
上级
07b136d2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
91 addition
and
92 deletion
+91
-92
packages/uni-components/src/components/slider/index.tsx
packages/uni-components/src/components/slider/index.tsx
+8
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+3
-0
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+36
-39
packages/uni-h5/src/service/api/context/createInnerAudioContext.ts
...uni-h5/src/service/api/context/createInnerAudioContext.ts
+44
-52
未找到文件。
packages/uni-components/src/components/slider/index.tsx
浏览文件 @
e243f654
import
{
computed
,
inject
,
onMounted
,
onBeforeUnmount
,
ref
}
from
'
vue
'
import
{
computed
,
inject
,
onMounted
,
onBeforeUnmount
,
ref
,
watch
}
from
'
vue
'
import
type
{
ExtractPropTypes
,
Ref
}
from
'
vue
'
import
{
defineBuiltInComponent
}
from
'
../../helpers/component
'
import
{
useTouchtrack
,
TouchtrackEvent
}
from
'
../../helpers/useTouchtrack
'
...
...
@@ -77,6 +77,13 @@ export default /*#__PURE__*/ defineBuiltInComponent({
const
sliderValueRef
:
HTMLRef
=
ref
(
null
)
const
sliderHandleRef
:
HTMLRef
=
ref
(
null
)
const
sliderValue
=
ref
(
Number
(
props
.
value
))
watch
(
()
=>
props
.
value
,
(
val
)
=>
{
sliderValue
.
value
=
Number
(
val
)
}
)
const
trigger
=
useCustomEvent
<
EmitEvent
<
typeof
emit
>>
(
sliderRef
,
emit
)
const
state
=
useSliderState
(
props
,
sliderValue
)
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
e243f654
...
...
@@ -6283,6 +6283,9 @@ var index$e = /* @__PURE__ */ defineBuiltInComponent({
const
sliderValueRef
=
vue
.
ref
(
null
);
const
sliderHandleRef
=
vue
.
ref
(
null
);
const
sliderValue
=
vue
.
ref
(
Number
(
props2
.
value
));
vue
.
watch
(()
=>
props2
.
value
,
(
val
)
=>
{
sliderValue
.
value
=
Number
(
val
);
});
const
trigger
=
useCustomEvent
(
sliderRef
,
emit2
);
const
state
=
useSliderState
(
props2
,
sliderValue
);
const
{
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
e243f654
...
...
@@ -485,7 +485,7 @@ var safeAreaInsets = {
onChange,
offChange
};
var out = safeAreaInsets;
var
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out = safeAreaInsets;
const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ withModifiers(() => {
...
...
@@ -497,10 +497,10 @@ function getWindowOffset() {
const left = parseInt(style.getPropertyValue("--window-left"));
const right = parseInt(style.getPropertyValue("--window-right"));
return {
top: top ? top + out.top : 0,
bottom: bottom ? bottom + out.bottom : 0,
left: left ? left + out.left : 0,
right: right ? right + out.right : 0
top: top ? top +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top : 0,
bottom: bottom ? bottom +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom : 0,
left: left ? left +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left : 0,
right: right ? right +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right : 0
};
}
function updateCssVar(cssVars) {
...
...
@@ -1190,7 +1190,7 @@ function normalizePageMeta(pageMeta) {
let offset = rpx2px(refreshOptions.offset);
const {type} = navigationBar;
if (type !== "transparent" && type !== "none") {
offset += NAVBAR_HEIGHT + out.top;
offset += NAVBAR_HEIGHT +
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top;
}
refreshOptions.offset = offset;
refreshOptions.height = rpx2px(refreshOptions.height);
...
...
@@ -8373,6 +8373,9 @@ var index$d = /* @__PURE__ */ defineBuiltInComponent({
const sliderValueRef = ref(null);
const sliderHandleRef = ref(null);
const sliderValue = ref(Number(props2.value));
watch(() => props2.value, (val) => {
sliderValue.value = Number(val);
});
const trigger = useCustomEvent(sliderRef, emit2);
const state2 = useSliderState(props2, sliderValue);
const {
...
...
@@ -14778,20 +14781,20 @@ const innerAudioContextOffEventNames = [
"offSeeking",
"offSeeked"
];
const propertys = [
"src",
"autoplay",
"loop",
"duration",
"currentTime",
"paused",
"volume"
];
class InnerAudioContext {
constructor() {
this._src = "";
var audio = this._audio = new Audio();
this._stoping = false;
const propertys = [
"src",
"autoplay",
"loop",
"duration",
"currentTime",
"paused",
"volume"
];
propertys.forEach((property) => {
Object.defineProperty(this, property, {
set: property === "src" ? (src) => {
...
...
@@ -14799,7 +14802,7 @@ class InnerAudioContext {
this._src = src;
return src;
} : (val) => {
audio
.setAttribute(property, val)
;
audio
[property] = val
;
return val;
},
get: property === "src" ? () => {
...
...
@@ -14815,7 +14818,6 @@ class InnerAudioContext {
get: () => false
});
Object.defineProperty(this, "buffered", {
set: () => false,
get() {
var buffered = audio.buffered;
if (buffered.length) {
...
...
@@ -14835,18 +14837,13 @@ class InnerAudioContext {
audio.currentTime = startTime;
}
});
var
eventNames = [
"canplay",
var
stopEventNames = ["canplay", "pause", "seeking", "seeked", "timeUpdate"];
var eventNames = stopEventNames.concat([
"play",
"pause",
"ended",
"timeUpdate",
"error",
"waiting",
"seeking",
"seeked"
];
var stopEventNames = ["canplay", "pause", "seeking", "seeked", "timeUpdate"];
"waiting"
]);
eventNames.forEach((eventName) => {
audio.addEventListener(eventName.toLowerCase(), () => {
if (this._stoping && stopEventNames.indexOf(eventName) >= 0) {
...
...
@@ -14917,7 +14914,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const language = navigator.language;
const statusBarHeight = out.top;
const statusBarHeight =
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top;
let osname;
let osversion;
let model;
...
...
@@ -15030,12 +15027,12 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
const safeArea = {
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth -
out.left -
out.right,
height: windowHeight -
out.top -
out.bottom
left:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left,
right: windowWidth -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
top:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top,
bottom: windowHeight -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom,
width: windowWidth -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
height: windowHeight -
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom
};
const {top: windowTop, bottom: windowBottom} = getWindowOffset();
windowHeight -= windowTop;
...
...
@@ -15055,10 +15052,10 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
model,
safeArea,
safeAreaInsets: {
top: out.top,
right: out.right,
bottom: out.bottom,
left: out.left
top:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.top,
right:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.right,
bottom:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.bottom,
left:
D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_
out.left
}
};
});
...
...
@@ -16292,14 +16289,14 @@ ${e2};at socketTask.on${capitalize(name)} callback function
}
});
});
const propertys
2
= [
const propertys = [
"CLOSED",
"CLOSING",
"CONNECTING",
"OPEN",
"readyState"
];
propertys
2
.forEach((property) => {
propertys.forEach((property) => {
Object.defineProperty(this, property, {
get() {
return webSocket[property];
...
...
packages/uni-h5/src/service/api/context/createInnerAudioContext.ts
浏览文件 @
e243f654
...
...
@@ -41,7 +41,6 @@ type Property =
type
InnerAudioProperty
=
keyof
Pick
<
HTMLMediaElement
,
Property
>
type
VoidFunction
=
(
callback
:
(
result
:
any
)
=>
void
)
=>
void
//#endregion
/**
...
...
@@ -73,17 +72,6 @@ const innerAudioContextOffEventNames: InnerAudioContextOff[] = [
'
offSeeked
'
,
]
// 和audio对象同名同效果的属性
const
propertys
:
InnerAudioProperty
[]
=
[
'
src
'
,
'
autoplay
'
,
'
loop
'
,
'
duration
'
,
'
currentTime
'
,
'
paused
'
,
'
volume
'
,
]
/**
* 音频上下文对象
*/
...
...
@@ -91,39 +79,39 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
/**
* 当前音频的长度(单位:s),只有在当前有合法的 src 时返回
*/
duration
!
:
number
'
duration
'
:
UniApp
.
InnerAudioContext
[
'
duration
'
]
/**
* 当前音频的播放位置(单位:s),只有在当前有合法的 src 时返回
*/
currentTime
!
:
number
'
currentTime
'
:
UniApp
.
InnerAudioContext
[
'
currentTime
'
]
/**
* 当前是是否暂停或停止状态,true 表示暂停或停止,false 表示正在播放
*/
paused
!
:
boolean
'
paused
'
:
UniApp
.
InnerAudioContext
[
'
paused
'
]
/**
* 音频的数据链接,用于直接播放。
*/
src
!
:
string
'
src
'
:
UniApp
.
InnerAudioContext
[
'
src
'
]
/**
* 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲
*/
buffered
!
:
number
'
buffered
'
:
UniApp
.
InnerAudioContext
[
'
buffered
'
]
/**
* 是否自动开始播放,默认 false
*/
autoplay
!
:
boolean
'
autoplay
'
:
UniApp
.
InnerAudioContext
[
'
autoplay
'
]
/**
* 是否循环播放,默认 false
*/
loop
!
:
boolean
'
loop
'
:
UniApp
.
InnerAudioContext
[
'
loop
'
]
/**
* 是否遵循系统静音开关,当此参数为 false 时,即使用户打开了静音开关,也能继续发出声音,默认值 true
*/
obeyMuteSwitch
!
:
boolean
'
obeyMuteSwitch
'
:
UniApp
.
InnerAudioContext
[
'
obeyMuteSwitch
'
]
/**
* 音量。范围 0~1。
*/
volume
!
:
number
'
volume
'
:
UniApp
.
InnerAudioContext
[
'
volume
'
]
/**
* 原始音频对象
*/
...
...
@@ -150,6 +138,16 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
constructor
()
{
var
audio
=
(
this
.
_audio
=
new
Audio
())
this
.
_stoping
=
false
// 和audio对象同名同效果的属性
const
propertys
:
InnerAudioProperty
[]
=
[
'
src
'
,
'
autoplay
'
,
'
loop
'
,
'
duration
'
,
'
currentTime
'
,
'
paused
'
,
'
volume
'
,
]
propertys
.
forEach
((
property
)
=>
{
Object
.
defineProperty
(
this
,
property
,
{
set
:
...
...
@@ -160,8 +158,7 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
return
src
}
:
(
val
)
=>
{
// audio[property] = val
audio
.
setAttribute
(
property
,
val
)
;(
audio
as
any
)[
property
]
=
val
return
val
},
get
:
...
...
@@ -180,7 +177,6 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
get
:
()
=>
false
,
})
Object
.
defineProperty
(
this
,
'
buffered
'
,
{
set
:
()
=>
false
,
get
()
{
var
buffered
=
audio
.
buffered
if
(
buffered
.
length
)
{
...
...
@@ -202,18 +198,14 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
}
})
// 和audio对象同名同效果的事件
var
eventNames
=
[
'
canplay
'
,
var
stopEventNames
=
[
'
canplay
'
,
'
pause
'
,
'
seeking
'
,
'
seeked
'
,
'
timeUpdate
'
]
var
eventNames
=
stopEventNames
.
concat
([
'
play
'
,
'
pause
'
,
'
ended
'
,
'
timeUpdate
'
,
'
error
'
,
'
waiting
'
,
'
seeking
'
,
'
seeked
'
,
]
var
stopEventNames
=
[
'
canplay
'
,
'
pause
'
,
'
seeking
'
,
'
seeked
'
,
'
timeUpdate
'
]
])
eventNames
.
forEach
((
eventName
)
=>
{
audio
.
addEventListener
(
eventName
.
toLowerCase
(),
...
...
@@ -280,27 +272,27 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
this
.
stop
()
}
'
onCanplay
'
:
VoidFunction
'
onPlay
'
:
VoidFunction
'
onPause
'
:
VoidFunction
'
onStop
'
:
VoidFunction
'
onEnded
'
:
VoidFunction
'
onTimeUpdate
'
:
VoidFunction
'
onError
'
:
VoidFunction
'
onWaiting
'
:
VoidFunction
'
onSeeking
'
:
VoidFunction
'
onSeeked
'
:
VoidFunction
'
onCanplay
'
:
UniApp
.
InnerAudioContext
[
'
onCanplay
'
]
'
onPlay
'
:
UniApp
.
InnerAudioContext
[
'
onPlay
'
]
'
onPause
'
:
UniApp
.
InnerAudioContext
[
'
onPause
'
]
'
onStop
'
:
UniApp
.
InnerAudioContext
[
'
onStop
'
]
'
onEnded
'
:
UniApp
.
InnerAudioContext
[
'
onEnded
'
]
'
onTimeUpdate
'
:
UniApp
.
InnerAudioContext
[
'
onTimeUpdate
'
]
'
onError
'
:
UniApp
.
InnerAudioContext
[
'
onError
'
]
'
onWaiting
'
:
UniApp
.
InnerAudioContext
[
'
onWaiting
'
]
'
onSeeking
'
:
UniApp
.
InnerAudioContext
[
'
onSeeking
'
]
'
onSeeked
'
:
UniApp
.
InnerAudioContext
[
'
onSeeked
'
]
'
offCanplay
'
:
VoidFunction
'
offPlay
'
:
VoidFunction
'
offPause
'
:
VoidFunction
'
offStop
'
:
VoidFunction
'
offEnded
'
:
VoidFunction
'
offTimeUpdate
'
:
VoidFunction
'
offError
'
:
VoidFunction
'
offWaiting
'
:
VoidFunction
'
offSeeking
'
:
VoidFunction
'
offSeeked
'
:
VoidFunction
'
offCanplay
'
:
UniApp
.
InnerAudioContext
[
'
offCanplay
'
]
'
offPlay
'
:
UniApp
.
InnerAudioContext
[
'
offPlay
'
]
'
offPause
'
:
UniApp
.
InnerAudioContext
[
'
offPause
'
]
'
offStop
'
:
UniApp
.
InnerAudioContext
[
'
offStop
'
]
'
offEnded
'
:
UniApp
.
InnerAudioContext
[
'
offEnded
'
]
'
offTimeUpdate
'
:
UniApp
.
InnerAudioContext
[
'
offTimeUpdate
'
]
'
offError
'
:
UniApp
.
InnerAudioContext
[
'
offError
'
]
'
offWaiting
'
:
UniApp
.
InnerAudioContext
[
'
offWaiting
'
]
'
offSeeking
'
:
UniApp
.
InnerAudioContext
[
'
offSeeking
'
]
'
offSeeked
'
:
UniApp
.
InnerAudioContext
[
'
offSeeked
'
]
}
// 批量设置音频上下文事件监听方法
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录