提交 75b816aa 编写于 作者: fxy060608's avatar fxy060608

chore: size-check

......@@ -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,
......
......@@ -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);
......
......@@ -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);
......
......@@ -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() {
......
......@@ -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)
}
}
})
/**
* 创建音频上下文
*/
......
......@@ -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');
......
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');
......
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.
先完成此消息的编辑!
想要评论请 注册