Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
75b816aa
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
75b816aa
编写于
5月 25, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
差异文件
chore: size-check
上级
3928e364
b82f78c6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
91 addition
and
75 deletion
+91
-75
packages/uni-components/src/helpers/useField.ts
packages/uni-components/src/helpers/useField.ts
+1
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+11
-9
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+34
-26
packages/uni-h5/src/framework/components/layout/index.tsx
packages/uni-h5/src/framework/components/layout/index.tsx
+16
-9
packages/uni-h5/src/service/api/context/createInnerAudioContext.ts
...uni-h5/src/service/api/context/createInnerAudioContext.ts
+24
-21
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+1
-1
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+2
-2
packages/uni-shared/src/dom/costomDataset.ts
packages/uni-shared/src/dom/costomDataset.ts
+2
-6
未找到文件。
packages/uni-components/src/helpers/useField.ts
浏览文件 @
75b816aa
...
...
@@ -189,7 +189,7 @@ function useBase(
var
maxlength
=
Number
(
props
.
maxlength
)
return
isNaN
(
maxlength
)
?
140
:
maxlength
})
const
value
=
getValueString
(
props
.
modelValue
||
props
.
value
)
const
value
=
getValueString
(
props
.
modelValue
)
||
getValueString
(
props
.
value
)
const
state
:
State
=
reactive
({
value
,
valueOrigin
:
value
,
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
75b816aa
...
...
@@ -2869,7 +2869,7 @@ function useBase(props2, rootRef, emit2) {
var
maxlength2
=
Number
(
props2
.
maxlength
);
return
isNaN
(
maxlength2
)
?
140
:
maxlength2
;
});
const
value
=
getValueString
(
props2
.
modelValue
||
props2
.
value
);
const
value
=
getValueString
(
props2
.
modelValue
)
||
getValueString
(
props2
.
value
);
const
state
=
vue
.
reactive
({
value
,
valueOrigin
:
value
,
...
...
@@ -10581,7 +10581,7 @@ var LayoutComponent = /* @__PURE__ */ defineSystemComponent({
const
{
layoutState
,
windowState
}
=
useState
()
;
}
=
__UNI_FEATURE_RESPONSIVE__
?
useState
()
:
{}
;
useMaxWidth
(
layoutState
,
rootRef
);
const
topWindow
=
__UNI_FEATURE_TOPWINDOW__
&&
useTopWindow
(
layoutState
);
const
leftWindow
=
__UNI_FEATURE_LEFTWINDOW__
&&
useLeftWindow
(
layoutState
);
...
...
@@ -10608,13 +10608,16 @@ function useAppClass(showTabBar) {
});
}
function
initMediaQuery
(
minWidth
,
callback
)
{
const
mediaQueryList
=
window
.
matchMedia
(
"
(min-width:
"
+
minWidth
+
"
px)
"
);
if
(
mediaQueryList
.
addEventListener
)
{
mediaQueryList
.
addEventListener
(
"
change
"
,
callback
);
}
else
{
mediaQueryList
.
addListener
(
callback
);
if
(
typeof
window
===
"
object
"
&&
window
.
matchMedia
)
{
const
mediaQueryList
=
window
.
matchMedia
(
"
(min-width:
"
+
minWidth
+
"
px)
"
);
if
(
mediaQueryList
.
addEventListener
)
{
mediaQueryList
.
addEventListener
(
"
change
"
,
callback
);
}
else
{
mediaQueryList
.
addListener
(
callback
);
}
return
mediaQueryList
.
matches
;
}
return
mediaQueryList
.
matches
;
return
false
;
}
function
useMaxWidth
(
layoutState
,
rootRef
)
{
const
route
=
usePageRoute
();
...
...
@@ -10646,7 +10649,6 @@ function useMaxWidth(layoutState, rootRef) {
}
}
vue
.
watch
([()
=>
route
.
path
],
checkMaxWidth
);
window
.
addEventListener
(
"
resize
"
,
checkMaxWidth
);
}
function
useState
()
{
const
topWindowMediaQuery
=
vue
.
ref
(
false
);
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
75b816aa
...
...
@@ -4656,7 +4656,7 @@ function useBase(props2, rootRef, emit2) {
var maxlength2 = Number(props2.maxlength);
return isNaN(maxlength2) ? 140 : maxlength2;
});
const value = getValueString(props2.modelValue
||
props2.value);
const value = getValueString(props2.modelValue
) || getValueString(
props2.value);
const state2 = reactive({
value,
valueOrigin: value,
...
...
@@ -14888,9 +14888,28 @@ const innerAudioContextOffEventNames = [
"offSeeking",
"offSeeked"
];
const initInnerAudioContextEventOnce = /* @__PURE__ */ once(() => {
innerAudioContextEventNames.forEach((eventName) => {
InnerAudioContext.prototype[eventName] = function(callback) {
if (typeof callback === "function") {
this._events[eventName].push(callback);
}
};
});
innerAudioContextOffEventNames.forEach((eventName) => {
InnerAudioContext.prototype[eventName] = function(callback) {
var handle = this._events[eventName.replace("off", "on")];
var index2 = handle.indexOf(callback);
if (index2 >= 0) {
handle.splice(index2, 1);
}
};
});
});
class InnerAudioContext {
constructor() {
this._src = "";
initInnerAudioContextEventOnce();
var audio = this._audio = new Audio();
this._stoping = false;
const propertys = [
...
...
@@ -14989,22 +15008,6 @@ class InnerAudioContext {
this.stop();
}
}
innerAudioContextEventNames.forEach((eventName) => {
InnerAudioContext.prototype[eventName] = function(callback) {
if (typeof callback === "function") {
this._events[eventName].push(callback);
}
};
});
innerAudioContextOffEventNames.forEach((eventName) => {
InnerAudioContext.prototype[eventName] = function(callback) {
var handle = this._events[eventName.replace("off", "on")];
var index2 = handle.indexOf(callback);
if (index2 >= 0) {
handle.splice(index2, 1);
}
};
});
const createInnerAudioContext = /* @__PURE__ */ defineSyncApi(API_CREATE_INNER_AUDIO_CONTEXT, () => {
return new InnerAudioContext();
});
...
...
@@ -18054,7 +18057,7 @@ var LayoutComponent = /* @__PURE__ */ defineSystemComponent({
const {
layoutState,
windowState
} =
useState()
;
} =
__UNI_FEATURE_RESPONSIVE__ ? useState() : {}
;
useMaxWidth(layoutState, rootRef);
const topWindow = __UNI_FEATURE_TOPWINDOW__ && useTopWindow(layoutState);
const leftWindow = __UNI_FEATURE_LEFTWINDOW__ && useLeftWindow(layoutState);
...
...
@@ -18092,13 +18095,16 @@ function initCssVar() {
});
}
function initMediaQuery(minWidth, callback) {
const mediaQueryList = window.matchMedia("(min-width: " + minWidth + "px)");
if (mediaQueryList.addEventListener) {
mediaQueryList.addEventListener("change", callback);
} else {
mediaQueryList.addListener(callback);
if (typeof window === "object" && window.matchMedia) {
const mediaQueryList = window.matchMedia("(min-width: " + minWidth + "px)");
if (mediaQueryList.addEventListener) {
mediaQueryList.addEventListener("change", callback);
} else {
mediaQueryList.addListener(callback);
}
return mediaQueryList.matches;
}
return
mediaQueryList.matches
;
return
false
;
}
function useMaxWidth(layoutState, rootRef) {
const route = usePageRoute();
...
...
@@ -18130,8 +18136,10 @@ function useMaxWidth(layoutState, rootRef) {
}
}
watch([() => route.path], checkMaxWidth);
onMounted(checkMaxWidth);
window.addEventListener("resize", checkMaxWidth);
onMounted(() => {
checkMaxWidth();
window.addEventListener("resize", checkMaxWidth);
});
}
function useState() {
const topWindowMediaQuery = ref(false);
...
...
packages/uni-h5/src/framework/components/layout/index.tsx
浏览文件 @
75b816aa
...
...
@@ -47,7 +47,9 @@ export default /*#__PURE__*/ defineSystemComponent({
!
__NODE_JS__
&&
initCssVar
()
const
keepAliveRoute
=
(
__UNI_FEATURE_PAGES__
&&
useKeepAliveRoute
())
as
KeepAliveRoute
const
{
layoutState
,
windowState
}
=
useState
()
const
{
layoutState
,
windowState
}
=
__UNI_FEATURE_RESPONSIVE__
?
useState
()
:
({}
as
ReturnType
<
typeof
useState
>
)
useMaxWidth
(
layoutState
,
rootRef
)
const
topWindow
=
__UNI_FEATURE_TOPWINDOW__
&&
useTopWindow
(
layoutState
)
const
leftWindow
=
__UNI_FEATURE_LEFTWINDOW__
&&
useLeftWindow
(
layoutState
)
...
...
@@ -128,13 +130,16 @@ function initMediaQuery(
minWidth
:
number
,
callback
:
(
ev
:
MediaQueryListEvent
)
=>
void
)
{
const
mediaQueryList
=
window
.
matchMedia
(
'
(min-width:
'
+
minWidth
+
'
px)
'
)
if
(
mediaQueryList
.
addEventListener
)
{
mediaQueryList
.
addEventListener
(
'
change
'
,
callback
)
}
else
{
mediaQueryList
.
addListener
(
callback
)
if
(
typeof
window
===
'
object
'
&&
window
.
matchMedia
)
{
const
mediaQueryList
=
window
.
matchMedia
(
'
(min-width:
'
+
minWidth
+
'
px)
'
)
if
(
mediaQueryList
.
addEventListener
)
{
mediaQueryList
.
addEventListener
(
'
change
'
,
callback
)
}
else
{
mediaQueryList
.
addListener
(
callback
)
}
return
mediaQueryList
.
matches
}
return
mediaQueryList
.
matches
return
false
}
function
useMaxWidth
(
...
...
@@ -173,8 +178,10 @@ function useMaxWidth(
}
}
watch
([()
=>
route
.
path
],
checkMaxWidth
)
onMounted
(
checkMaxWidth
)
window
.
addEventListener
(
'
resize
'
,
checkMaxWidth
)
onMounted
(()
=>
{
checkMaxWidth
()
window
.
addEventListener
(
'
resize
'
,
checkMaxWidth
)
})
}
function
useState
()
{
...
...
packages/uni-h5/src/service/api/context/createInnerAudioContext.ts
浏览文件 @
75b816aa
...
...
@@ -4,6 +4,7 @@ import {
defineSyncApi
,
}
from
'
@dcloudio/uni-api
'
import
type
{
API_TYPE_CREATEE_INNER_AUDIO_CONTEXT
}
from
'
@dcloudio/uni-api
'
import
{
once
}
from
'
@dcloudio/uni-shared
'
//#region types
type
InnerAudioContextEvent
=
...
...
@@ -72,6 +73,28 @@ const innerAudioContextOffEventNames: InnerAudioContextOff[] = [
'
offSeeked
'
,
]
const
initInnerAudioContextEventOnce
=
/*#__PURE__*/
once
(()
=>
{
// 批量设置音频上下文事件监听方法
innerAudioContextEventNames
.
forEach
((
eventName
)
=>
{
InnerAudioContext
.
prototype
[
eventName
]
=
function
(
callback
:
Function
)
{
if
(
typeof
callback
===
'
function
'
)
{
this
.
_events
[
eventName
]
!
.
push
(
callback
)
}
}
})
// 批量设置音频上下文事件取消监听方法
innerAudioContextOffEventNames
.
forEach
((
eventName
)
=>
{
InnerAudioContext
.
prototype
[
eventName
]
=
function
(
callback
:
Function
)
{
var
handle
=
this
.
_events
[
eventName
.
replace
(
'
off
'
,
'
on
'
)
as
InnerAudioContextEvent
]
var
index
=
handle
!
.
indexOf
(
callback
)
if
(
index
>=
0
)
{
handle
!
.
splice
(
index
,
1
)
}
}
})
})
/**
* 音频上下文对象
*/
...
...
@@ -136,6 +159,7 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
* 音频上下文初始化
*/
constructor
()
{
initInnerAudioContextEventOnce
()
var
audio
=
(
this
.
_audio
=
new
Audio
())
this
.
_stoping
=
false
// 和audio对象同名同效果的属性
...
...
@@ -295,27 +319,6 @@ class InnerAudioContext implements UniApp.InnerAudioContext {
'
offSeeked
'
:
UniApp
.
InnerAudioContext
[
'
offSeeked
'
]
}
// 批量设置音频上下文事件监听方法
innerAudioContextEventNames
.
forEach
((
eventName
)
=>
{
InnerAudioContext
.
prototype
[
eventName
]
=
function
(
callback
:
Function
)
{
if
(
typeof
callback
===
'
function
'
)
{
this
.
_events
[
eventName
]
!
.
push
(
callback
)
}
}
})
// 批量设置音频上下文事件取消监听方法
innerAudioContextOffEventNames
.
forEach
((
eventName
)
=>
{
InnerAudioContext
.
prototype
[
eventName
]
=
function
(
callback
:
Function
)
{
var
handle
=
this
.
_events
[
eventName
.
replace
(
'
off
'
,
'
on
'
)
as
InnerAudioContextEvent
]
var
index
=
handle
!
.
indexOf
(
callback
)
if
(
index
>=
0
)
{
handle
!
.
splice
(
index
,
1
)
}
}
})
/**
* 创建音频上下文
*/
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
75b816aa
...
...
@@ -29,7 +29,7 @@ function initCostomDataset() {
};
}
function
getCostomDataset
(
el
)
{
return
Object
.
assign
({},
el
.
dataset
,
el
.
__uniDataset
);
return
shared
.
extend
({},
el
.
dataset
,
el
.
__uniDataset
);
}
const
unitRE
=
new
RegExp
(
`"[^"]+"|'[^']+'|url\\([^)]+\\)|(\\d*\\.?\\d+)[r|u]px`
,
'
g
'
);
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
75b816aa
import
{
camelize
,
isString
,
isHTMLTag
,
isSVGTag
,
isPlainObject
,
isArray
}
from
'
@vue/shared
'
;
import
{
camelize
,
extend
,
isString
,
isHTMLTag
,
isSVGTag
,
isPlainObject
,
isArray
}
from
'
@vue/shared
'
;
function
formatKey
(
key
)
{
return
camelize
(
key
.
substring
(
5
));
...
...
@@ -25,7 +25,7 @@ function initCostomDataset() {
};
}
function
getCostomDataset
(
el
)
{
return
Object
.
assign
({},
el
.
dataset
,
el
.
__uniDataset
);
return
extend
({},
el
.
dataset
,
el
.
__uniDataset
);
}
const
unitRE
=
new
RegExp
(
`"[^"]+"|'[^']+'|url\\([^)]+\\)|(\\d*\\.?\\d+)[r|u]px`
,
'
g
'
);
...
...
packages/uni-shared/src/dom/costomDataset.ts
浏览文件 @
75b816aa
import
{
camelize
}
from
'
@vue/shared
'
import
{
extend
,
camelize
}
from
'
@vue/shared
'
interface
HTMLElementWithDataset
extends
HTMLElement
{
__uniDataset
?:
Record
<
string
,
any
>
}
...
...
@@ -33,9 +33,5 @@ export function initCostomDataset() {
}
export
function
getCostomDataset
(
el
:
HTMLElement
|
HTMLElementWithDataset
)
{
return
Object
.
assign
(
{},
el
.
dataset
,
(
el
as
HTMLElementWithDataset
).
__uniDataset
)
return
extend
({},
el
.
dataset
,
(
el
as
HTMLElementWithDataset
).
__uniDataset
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录