Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
陈庄旺
uni-app
提交
86f6afb8
U
uni-app
项目概览
陈庄旺
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
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,发现更多精彩内容 >>
提交
86f6afb8
编写于
2月 11, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(h5): initCustomDataset (question/139181)
上级
e351f355
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
743 addition
and
848 deletion
+743
-848
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+61
-61
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+3
-3
packages/uni-core/src/view/init/index.ts
packages/uni-core/src/view/init/index.ts
+2
-2
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+2
-2
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+14
-14
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+14
-14
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+14
-14
packages/uni-mp-lark/dist/uni.mp.esm.js
packages/uni-mp-lark/dist/uni.mp.esm.js
+14
-14
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+14
-14
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+14
-14
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+14
-14
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+14
-14
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+99
-98
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+1
-1
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+100
-99
packages/uni-shared/src/dom/customDataset.ts
packages/uni-shared/src/dom/customDataset.ts
+4
-2
packages/uni-shared/src/dom/index.ts
packages/uni-shared/src/dom/index.ts
+1
-1
pnpm-lock.yaml
pnpm-lock.yaml
+358
-467
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
86f6afb8
...
...
@@ -212,6 +212,67 @@ var serviceContext = (function (vue) {
.join(' ')}`;
}
function cache(fn) {
const cache = Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
function cacheStringFunction(fn) {
return cache(fn);
}
function getLen(str = '') {
return ('' + str).replace(/[^\x00-\xff]/g, '**').length;
}
function hasLeadingSlash(str) {
return str.indexOf('/') === 0;
}
function addLeadingSlash(str) {
return hasLeadingSlash(str) ? str : '/' + str;
}
function removeLeadingSlash(str) {
return hasLeadingSlash(str) ? str.substr(1) : str;
}
const invokeArrayFns = (fns, arg) => {
let ret;
for (let i = 0; i < fns.length; i++) {
ret = fns[i](arg);
}
return ret;
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
function callOptions(options, data) {
options = options || {};
if (typeof data === 'string') {
data = {
errMsg: data,
};
}
if (/:ok$/.test(data.errMsg)) {
if (typeof options.success === 'function') {
options.success(data);
}
}
else {
if (typeof options.fail === 'function') {
options.fail(data);
}
}
if (typeof options.complete === 'function') {
options.complete(data);
}
}
const encode$2 = encodeURIComponent;
function stringifyQuery$1(obj, encodeStr = encode$2) {
const res = obj
...
...
@@ -533,67 +594,6 @@ var serviceContext = (function (vue) {
const ACTION_TYPE_PAGE_SCROLL = 15;
const ACTION_TYPE_EVENT = 20;
function cache(fn) {
const cache = Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
}
function cacheStringFunction(fn) {
return cache(fn);
}
function getLen(str = '') {
return ('' + str).replace(/[^\x00-\xff]/g, '**').length;
}
function hasLeadingSlash(str) {
return str.indexOf('/') === 0;
}
function addLeadingSlash(str) {
return hasLeadingSlash(str) ? str : '/' + str;
}
function removeLeadingSlash(str) {
return hasLeadingSlash(str) ? str.substr(1) : str;
}
const invokeArrayFns = (fns, arg) => {
let ret;
for (let i = 0; i < fns.length; i++) {
ret = fns[i](arg);
}
return ret;
};
function once(fn, ctx = null) {
let res;
return ((...args) => {
if (fn) {
res = fn.apply(ctx, args);
fn = null;
}
return res;
});
}
function callOptions(options, data) {
options = options || {};
if (typeof data === 'string') {
data = {
errMsg: data,
};
}
if (/:ok$/.test(data.errMsg)) {
if (typeof options.success === 'function') {
options.success(data);
}
}
else {
if (typeof options.fail === 'function') {
options.fail(data);
}
}
if (typeof options.complete === 'function') {
options.complete(data);
}
}
function debounce(fn, delay) {
let timeout;
const newFn = function () {
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
86f6afb8
此差异已折叠。
点击以展开。
packages/uni-core/src/view/init/index.ts
浏览文件 @
86f6afb8
import
{
initCustomDataset
}
from
'
@dcloudio/uni-shared
'
import
{
initCustomDataset
Once
}
from
'
@dcloudio/uni-shared
'
import
{
initLongPress
}
from
'
./longPress
'
import
{
useRem
}
from
'
./rem
'
...
...
@@ -7,7 +7,7 @@ export function initView() {
return
}
useRem
()
initCustomDataset
()
initCustomDataset
Once
()
if
(
__UNI_FEATURE_LONGPRESS__
)
{
initLongPress
()
}
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
86f6afb8
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, Comment, createTextVNode, onBeforeActivate, onBeforeDeactivate, createBlock, renderList, onDeactivated, createApp, Transition, effectScope, withCtx, KeepAlive, resolveDynamicComponent, createElementVNode, normalizeStyle, renderSlot } from "vue";
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 { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, initCustomDataset, resolveComponentInstance, addLeadingSlash, 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, LINEFEED, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, 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_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, initCustomDataset
Once
, resolveComponentInstance, addLeadingSlash, 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, LINEFEED, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, 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_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, 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 { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
const isEnableLocale = /* @__PURE__ */ once(() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
...
...
@@ -498,7 +498,7 @@ function useRem() {
}
function initView() {
useRem();
initCustomDataset();
initCustomDataset
Once
();
if (__UNI_FEATURE_LONGPRESS__) {
initLongPress();
}
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -30,6 +30,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -50,20 +64,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -98,6 +98,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -118,20 +132,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -93,6 +93,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -113,20 +127,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
packages/uni-mp-lark/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -93,6 +93,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -113,20 +127,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -93,6 +93,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -113,20 +127,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -93,6 +93,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -113,20 +127,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -28,6 +28,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -48,20 +62,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
=
/*#__PURE__*/
(()
=>
{
return
{
onPageScroll
:
1
,
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
86f6afb8
...
...
@@ -93,6 +93,20 @@ function customizeEvent(str) {
return
camelize
(
str
.
replace
(
customizeRE
,
'
-
'
));
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
const
encode
=
encodeURIComponent
;
function
stringifyQuery
(
obj
,
encodeStr
=
encode
)
{
const
res
=
obj
...
...
@@ -113,20 +127,6 @@ function stringifyQuery(obj, encodeStr = encode) {
return
res
?
`?
${
res
}
`
:
''
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
class
EventChannel
{
constructor
(
id
,
events
)
{
this
.
id
=
id
;
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
86f6afb8
...
...
@@ -300,10 +300,106 @@ function formatLog(module, ...args) {
.
join
(
'
'
)}
`
;
}
function
cache
(
fn
)
{
const
cache
=
Object
.
create
(
null
);
return
(
str
)
=>
{
const
hit
=
cache
[
str
];
return
hit
||
(
cache
[
str
]
=
fn
(
str
));
};
}
function
cacheStringFunction
(
fn
)
{
return
cache
(
fn
);
}
function
getLen
(
str
=
''
)
{
return
(
''
+
str
).
replace
(
/
[^\x
00-
\x
ff
]
/g
,
'
**
'
).
length
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
function
removeLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
.
substr
(
1
)
:
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
function
updateElementStyle
(
element
,
styles
)
{
for
(
const
attrName
in
styles
)
{
element
.
style
[
attrName
]
=
styles
[
attrName
];
}
}
function
once
(
fn
,
ctx
=
null
)
{
let
res
;
return
((...
args
)
=>
{
if
(
fn
)
{
res
=
fn
.
apply
(
ctx
,
args
);
fn
=
null
;
}
return
res
;
});
}
const
sanitise
=
(
val
)
=>
(
val
&&
JSON
.
parse
(
JSON
.
stringify
(
val
)))
||
val
;
const
_completeValue
=
(
value
)
=>
(
value
>
9
?
value
:
'
0
'
+
value
);
function
formatDateTime
({
date
=
new
Date
(),
mode
=
'
date
'
})
{
if
(
mode
===
'
time
'
)
{
return
(
_completeValue
(
date
.
getHours
())
+
'
:
'
+
_completeValue
(
date
.
getMinutes
()));
}
else
{
return
(
date
.
getFullYear
()
+
'
-
'
+
_completeValue
(
date
.
getMonth
()
+
1
)
+
'
-
'
+
_completeValue
(
date
.
getDate
()));
}
}
function
callOptions
(
options
,
data
)
{
options
=
options
||
{};
if
(
typeof
data
===
'
string
'
)
{
data
=
{
errMsg
:
data
,
};
}
if
(
/:ok$/
.
test
(
data
.
errMsg
))
{
if
(
typeof
options
.
success
===
'
function
'
)
{
options
.
success
(
data
);
}
}
else
{
if
(
typeof
options
.
fail
===
'
function
'
)
{
options
.
fail
(
data
);
}
}
if
(
typeof
options
.
complete
===
'
function
'
)
{
options
.
complete
(
data
);
}
}
function
getValueByDataPath
(
obj
,
path
)
{
if
(
!
shared
.
isString
(
path
))
{
return
;
}
path
=
path
.
replace
(
/
\[(\d
+
)\]
/g
,
'
.$1
'
);
const
parts
=
path
.
split
(
'
.
'
);
let
key
=
parts
[
0
];
if
(
!
obj
)
{
obj
=
{};
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
];
}
return
getValueByDataPath
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
));
}
function
formatKey
(
key
)
{
return
shared
.
camelize
(
key
.
substring
(
5
));
}
function
initCustomDataset
()
{
// question/139181,增加副作用,避免 initCustomDataset 在 build 下被 tree-shaking
const
initCustomDatasetOnce
=
/*#__PURE__*/
once
(()
=>
{
const
prototype
=
HTMLElement
.
prototype
;
const
setAttribute
=
prototype
.
setAttribute
;
prototype
.
setAttribute
=
function
(
key
,
value
)
{
...
...
@@ -323,7 +419,7 @@ function initCustomDataset() {
}
removeAttribute
.
call
(
this
,
key
);
};
}
}
);
function
getCustomDataset
(
el
)
{
return
shared
.
extend
({},
el
.
dataset
,
el
.
__uniDataset
);
}
...
...
@@ -1063,101 +1159,6 @@ const ACTION_TYPE_ADD_WXS_EVENT = 12;
const
ACTION_TYPE_PAGE_SCROLL
=
15
;
const
ACTION_TYPE_EVENT
=
20
;
function
cache
(
fn
)
{
const
cache
=
Object
.
create
(
null
);
return
(
str
)
=>
{
const
hit
=
cache
[
str
];
return
hit
||
(
cache
[
str
]
=
fn
(
str
));
};
}
function
cacheStringFunction
(
fn
)
{
return
cache
(
fn
);
}
function
getLen
(
str
=
''
)
{
return
(
''
+
str
).
replace
(
/
[^\x
00-
\x
ff
]
/g
,
'
**
'
).
length
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
function
removeLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
.
substr
(
1
)
:
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
function
updateElementStyle
(
element
,
styles
)
{
for
(
const
attrName
in
styles
)
{
element
.
style
[
attrName
]
=
styles
[
attrName
];
}
}
function
once
(
fn
,
ctx
=
null
)
{
let
res
;
return
((...
args
)
=>
{
if
(
fn
)
{
res
=
fn
.
apply
(
ctx
,
args
);
fn
=
null
;
}
return
res
;
});
}
const
sanitise
=
(
val
)
=>
(
val
&&
JSON
.
parse
(
JSON
.
stringify
(
val
)))
||
val
;
const
_completeValue
=
(
value
)
=>
(
value
>
9
?
value
:
'
0
'
+
value
);
function
formatDateTime
({
date
=
new
Date
(),
mode
=
'
date
'
})
{
if
(
mode
===
'
time
'
)
{
return
(
_completeValue
(
date
.
getHours
())
+
'
:
'
+
_completeValue
(
date
.
getMinutes
()));
}
else
{
return
(
date
.
getFullYear
()
+
'
-
'
+
_completeValue
(
date
.
getMonth
()
+
1
)
+
'
-
'
+
_completeValue
(
date
.
getDate
()));
}
}
function
callOptions
(
options
,
data
)
{
options
=
options
||
{};
if
(
typeof
data
===
'
string
'
)
{
data
=
{
errMsg
:
data
,
};
}
if
(
/:ok$/
.
test
(
data
.
errMsg
))
{
if
(
typeof
options
.
success
===
'
function
'
)
{
options
.
success
(
data
);
}
}
else
{
if
(
typeof
options
.
fail
===
'
function
'
)
{
options
.
fail
(
data
);
}
}
if
(
typeof
options
.
complete
===
'
function
'
)
{
options
.
complete
(
data
);
}
}
function
getValueByDataPath
(
obj
,
path
)
{
if
(
!
shared
.
isString
(
path
))
{
return
;
}
path
=
path
.
replace
(
/
\[(\d
+
)\]
/g
,
'
.$1
'
);
const
parts
=
path
.
split
(
'
.
'
);
let
key
=
parts
[
0
];
if
(
!
obj
)
{
obj
=
{};
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
];
}
return
getValueByDataPath
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
));
}
function
debounce
(
fn
,
delay
)
{
let
timeout
;
const
newFn
=
function
()
{
...
...
@@ -1471,7 +1472,7 @@ exports.getCustomDataset = getCustomDataset;
exports
.
getEnvLocale
=
getEnvLocale
;
exports
.
getLen
=
getLen
;
exports
.
getValueByDataPath
=
getValueByDataPath
;
exports
.
initCustomDataset
=
initCustomDataset
;
exports
.
initCustomDataset
Once
=
initCustomDatasetOnce
;
exports
.
invokeArrayFns
=
invokeArrayFns
;
exports
.
isAppNVueNativeTag
=
isAppNVueNativeTag
;
exports
.
isAppNativeTag
=
isAppNativeTag
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
86f6afb8
...
...
@@ -231,7 +231,7 @@ declare interface HTMLElementWithDataset extends HTMLElement {
export
declare
const
I18N_JSON_DELIMITERS
:
[
string
,
string
];
export
declare
function
initCustomDataset
():
void
;
export
declare
const
initCustomDatasetOnce
:
()
=>
void
;
/**
* nodeId
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
86f6afb8
import
{
isHTMLTag
,
isSVGTag
,
hyphenate
,
camelize
,
extend
,
isString
,
isPlainObject
,
isArray
,
toTypeString
,
toRawType
,
capitalize
}
from
'
@vue/shared
'
;
import
{
isHTMLTag
,
isSVGTag
,
hyphenate
,
camelize
,
isString
,
extend
,
isPlainObject
,
isArray
,
toTypeString
,
toRawType
,
capitalize
}
from
'
@vue/shared
'
;
const
BUILT_IN_TAG_NAMES
=
[
'
ad
'
,
...
...
@@ -296,10 +296,106 @@ function formatLog(module, ...args) {
.
join
(
'
'
)}
`
;
}
function
cache
(
fn
)
{
const
cache
=
Object
.
create
(
null
);
return
(
str
)
=>
{
const
hit
=
cache
[
str
];
return
hit
||
(
cache
[
str
]
=
fn
(
str
));
};
}
function
cacheStringFunction
(
fn
)
{
return
cache
(
fn
);
}
function
getLen
(
str
=
''
)
{
return
(
''
+
str
).
replace
(
/
[^\x
00-
\x
ff
]
/g
,
'
**
'
).
length
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
function
removeLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
.
substr
(
1
)
:
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
function
updateElementStyle
(
element
,
styles
)
{
for
(
const
attrName
in
styles
)
{
element
.
style
[
attrName
]
=
styles
[
attrName
];
}
}
function
once
(
fn
,
ctx
=
null
)
{
let
res
;
return
((...
args
)
=>
{
if
(
fn
)
{
res
=
fn
.
apply
(
ctx
,
args
);
fn
=
null
;
}
return
res
;
});
}
const
sanitise
=
(
val
)
=>
(
val
&&
JSON
.
parse
(
JSON
.
stringify
(
val
)))
||
val
;
const
_completeValue
=
(
value
)
=>
(
value
>
9
?
value
:
'
0
'
+
value
);
function
formatDateTime
({
date
=
new
Date
(),
mode
=
'
date
'
})
{
if
(
mode
===
'
time
'
)
{
return
(
_completeValue
(
date
.
getHours
())
+
'
:
'
+
_completeValue
(
date
.
getMinutes
()));
}
else
{
return
(
date
.
getFullYear
()
+
'
-
'
+
_completeValue
(
date
.
getMonth
()
+
1
)
+
'
-
'
+
_completeValue
(
date
.
getDate
()));
}
}
function
callOptions
(
options
,
data
)
{
options
=
options
||
{};
if
(
typeof
data
===
'
string
'
)
{
data
=
{
errMsg
:
data
,
};
}
if
(
/:ok$/
.
test
(
data
.
errMsg
))
{
if
(
typeof
options
.
success
===
'
function
'
)
{
options
.
success
(
data
);
}
}
else
{
if
(
typeof
options
.
fail
===
'
function
'
)
{
options
.
fail
(
data
);
}
}
if
(
typeof
options
.
complete
===
'
function
'
)
{
options
.
complete
(
data
);
}
}
function
getValueByDataPath
(
obj
,
path
)
{
if
(
!
isString
(
path
))
{
return
;
}
path
=
path
.
replace
(
/
\[(\d
+
)\]
/g
,
'
.$1
'
);
const
parts
=
path
.
split
(
'
.
'
);
let
key
=
parts
[
0
];
if
(
!
obj
)
{
obj
=
{};
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
];
}
return
getValueByDataPath
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
));
}
function
formatKey
(
key
)
{
return
camelize
(
key
.
substring
(
5
));
}
function
initCustomDataset
()
{
// question/139181,增加副作用,避免 initCustomDataset 在 build 下被 tree-shaking
const
initCustomDatasetOnce
=
/*#__PURE__*/
once
(()
=>
{
const
prototype
=
HTMLElement
.
prototype
;
const
setAttribute
=
prototype
.
setAttribute
;
prototype
.
setAttribute
=
function
(
key
,
value
)
{
...
...
@@ -319,7 +415,7 @@ function initCustomDataset() {
}
removeAttribute
.
call
(
this
,
key
);
};
}
}
);
function
getCustomDataset
(
el
)
{
return
extend
({},
el
.
dataset
,
el
.
__uniDataset
);
}
...
...
@@ -1059,101 +1155,6 @@ const ACTION_TYPE_ADD_WXS_EVENT = 12;
const
ACTION_TYPE_PAGE_SCROLL
=
15
;
const
ACTION_TYPE_EVENT
=
20
;
function
cache
(
fn
)
{
const
cache
=
Object
.
create
(
null
);
return
(
str
)
=>
{
const
hit
=
cache
[
str
];
return
hit
||
(
cache
[
str
]
=
fn
(
str
));
};
}
function
cacheStringFunction
(
fn
)
{
return
cache
(
fn
);
}
function
getLen
(
str
=
''
)
{
return
(
''
+
str
).
replace
(
/
[^\x
00-
\x
ff
]
/g
,
'
**
'
).
length
;
}
function
hasLeadingSlash
(
str
)
{
return
str
.
indexOf
(
'
/
'
)
===
0
;
}
function
addLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
:
'
/
'
+
str
;
}
function
removeLeadingSlash
(
str
)
{
return
hasLeadingSlash
(
str
)
?
str
.
substr
(
1
)
:
str
;
}
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
let
ret
;
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
ret
=
fns
[
i
](
arg
);
}
return
ret
;
};
function
updateElementStyle
(
element
,
styles
)
{
for
(
const
attrName
in
styles
)
{
element
.
style
[
attrName
]
=
styles
[
attrName
];
}
}
function
once
(
fn
,
ctx
=
null
)
{
let
res
;
return
((...
args
)
=>
{
if
(
fn
)
{
res
=
fn
.
apply
(
ctx
,
args
);
fn
=
null
;
}
return
res
;
});
}
const
sanitise
=
(
val
)
=>
(
val
&&
JSON
.
parse
(
JSON
.
stringify
(
val
)))
||
val
;
const
_completeValue
=
(
value
)
=>
(
value
>
9
?
value
:
'
0
'
+
value
);
function
formatDateTime
({
date
=
new
Date
(),
mode
=
'
date
'
})
{
if
(
mode
===
'
time
'
)
{
return
(
_completeValue
(
date
.
getHours
())
+
'
:
'
+
_completeValue
(
date
.
getMinutes
()));
}
else
{
return
(
date
.
getFullYear
()
+
'
-
'
+
_completeValue
(
date
.
getMonth
()
+
1
)
+
'
-
'
+
_completeValue
(
date
.
getDate
()));
}
}
function
callOptions
(
options
,
data
)
{
options
=
options
||
{};
if
(
typeof
data
===
'
string
'
)
{
data
=
{
errMsg
:
data
,
};
}
if
(
/:ok$/
.
test
(
data
.
errMsg
))
{
if
(
typeof
options
.
success
===
'
function
'
)
{
options
.
success
(
data
);
}
}
else
{
if
(
typeof
options
.
fail
===
'
function
'
)
{
options
.
fail
(
data
);
}
}
if
(
typeof
options
.
complete
===
'
function
'
)
{
options
.
complete
(
data
);
}
}
function
getValueByDataPath
(
obj
,
path
)
{
if
(
!
isString
(
path
))
{
return
;
}
path
=
path
.
replace
(
/
\[(\d
+
)\]
/g
,
'
.$1
'
);
const
parts
=
path
.
split
(
'
.
'
);
let
key
=
parts
[
0
];
if
(
!
obj
)
{
obj
=
{};
}
if
(
parts
.
length
===
1
)
{
return
obj
[
key
];
}
return
getValueByDataPath
(
obj
[
key
],
parts
.
slice
(
1
).
join
(
'
.
'
));
}
function
debounce
(
fn
,
delay
)
{
let
timeout
;
const
newFn
=
function
()
{
...
...
@@ -1343,4 +1344,4 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
BUILT_IN_TAG_NAMES
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
E$1
as
Emitter
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVUE_BUILT_IN_TAGS
,
NVUE_U_BUILT_IN_TAGS
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UNI_STORAGE_LOCALE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
customizeEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultNVueRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatH5Log
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDataset
,
invokeArrayFns
,
isAppNVueNativeTag
,
isAppNativeTag
,
isBuiltInComponent
,
isComponentInternalInstance
,
isComponentTag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveComponentInstance
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
BUILT_IN_TAG_NAMES
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
E$1
as
Emitter
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
MINI_PROGRAM_PAGE_RUNTIME_HOOKS
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVUE_BUILT_IN_TAGS
,
NVUE_U_BUILT_IN_TAGS
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UNI_STORAGE_LOCALE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
customizeEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultNVueRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatH5Log
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDataset
Once
,
invokeArrayFns
,
isAppNVueNativeTag
,
isAppNativeTag
,
isBuiltInComponent
,
isComponentInternalInstance
,
isComponentTag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveComponentInstance
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
packages/uni-shared/src/dom/customDataset.ts
浏览文件 @
86f6afb8
import
{
extend
,
camelize
}
from
'
@vue/shared
'
import
{
once
}
from
'
../utils
'
interface
HTMLElementWithDataset
extends
HTMLElement
{
__uniDataset
?:
Record
<
string
,
any
>
}
...
...
@@ -7,7 +8,8 @@ function formatKey(key: string) {
return
camelize
(
key
.
substring
(
5
))
}
export
function
initCustomDataset
()
{
// question/139181,增加副作用,避免 initCustomDataset 在 build 下被 tree-shaking
export
const
initCustomDatasetOnce
=
/*#__PURE__*/
once
(()
=>
{
const
prototype
=
HTMLElement
.
prototype
const
setAttribute
=
prototype
.
setAttribute
prototype
.
setAttribute
=
function
(
key
,
value
)
{
...
...
@@ -30,7 +32,7 @@ export function initCustomDataset() {
}
removeAttribute
.
call
(
this
,
key
)
}
}
}
)
export
function
getCustomDataset
(
el
:
HTMLElement
|
HTMLElementWithDataset
)
{
return
extend
({},
el
.
dataset
,
(
el
as
HTMLElementWithDataset
).
__uniDataset
)
...
...
packages/uni-shared/src/dom/index.ts
浏览文件 @
86f6afb8
import
{
isString
}
from
'
@vue/shared
'
import
{
getCustomDataset
}
from
'
./customDataset
'
export
{
initCustomDataset
,
getCustomDataset
}
from
'
./customDataset
'
export
{
initCustomDataset
Once
,
getCustomDataset
}
from
'
./customDataset
'
export
*
from
'
./style
'
...
...
pnpm-lock.yaml
浏览文件 @
86f6afb8
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录