Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
1545a9f0
U
uni-app
项目概览
DCloud
/
uni-app
4 天 前同步成功
通知
815
Star
38709
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
8
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
8
Issue
8
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
1545a9f0
编写于
12月 02, 2023
作者:
I
im-robot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: build types metadata
上级
482d634d
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
0 addition
and
20926 deletion
+0
-20926
packages/uni-app-plus/dist/style.css
packages/uni-app-plus/dist/style.css
+0
-1
packages/uni-app-plus/dist/tools.umd.js
packages/uni-app-plus/dist/tools.umd.js
+0
-182
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+0
-1
packages/uni-app-plus/dist/uni.compiler.js
packages/uni-app-plus/dist/uni.compiler.js
+0
-13
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+0
-20444
packages/uni-app-plus/dist/uni.vue.js
packages/uni-app-plus/dist/uni.vue.js
+0
-285
未找到文件。
packages/uni-app-plus/dist/style.css
已删除
100644 → 0
浏览文件 @
482d634d
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/tools.umd.js
已删除
100644 → 0
浏览文件 @
482d634d
(
function
(
global
,
factory
)
{
typeof
exports
===
'
object
'
&&
typeof
module
!==
'
undefined
'
?
factory
(
exports
)
:
typeof
define
===
'
function
'
&&
define
.
amd
?
define
([
'
exports
'
],
factory
)
:
(
global
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
global
||
self
,
factory
(
global
.
Tools
=
{}));
})(
this
,
(
function
(
exports
)
{
'
use strict
'
;
/**
* Make a map and return a function for checking if a key
* is in that map.
* IMPORTANT: all calls of this function must be prefixed with
* \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary.
*/
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
Object
.
freeze
({})
:
{};
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
Object
.
freeze
([])
:
[];
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
const
hasOwn
=
(
val
,
key
)
=>
hasOwnProperty
.
call
(
val
,
key
);
const
ACTION_TYPE_PAGE_CREATE
=
1
;
const
ACTION_TYPE_PAGE_CREATED
=
2
;
const
ACTION_TYPE_CREATE
=
3
;
const
ACTION_TYPE_INSERT
=
4
;
const
ACTION_TYPE_REMOVE
=
5
;
const
ACTION_TYPE_SET_ATTRIBUTE
=
6
;
const
ACTION_TYPE_REMOVE_ATTRIBUTE
=
7
;
const
ACTION_TYPE_ADD_EVENT
=
8
;
const
ACTION_TYPE_REMOVE_EVENT
=
9
;
const
ACTION_TYPE_SET_TEXT
=
10
;
const
ACTION_TYPE_ADD_WXS_EVENT
=
12
;
const
ACTION_TYPE_DICT
=
0
;
function
createGetDict
(
dict
)
{
if
(
!
dict
.
length
)
{
return
(
v
)
=>
v
;
}
const
getDict
=
(
value
,
includeValue
=
true
)
=>
{
if
(
typeof
value
===
'
number
'
)
{
return
dict
[
value
];
}
const
res
=
{};
value
.
forEach
(([
n
,
v
])
=>
{
if
(
includeValue
)
{
res
[
getDict
(
n
)]
=
getDict
(
v
);
}
else
{
res
[
getDict
(
n
)]
=
v
;
}
});
return
res
;
};
return
getDict
;
}
function
decodeActions
(
actions
)
{
const
[
type
,
dict
]
=
actions
[
0
];
if
(
type
!==
ACTION_TYPE_DICT
)
{
return
actions
;
}
const
getDict
=
createGetDict
(
dict
);
return
actions
.
map
((
action
)
=>
{
switch
(
action
[
0
])
{
case
ACTION_TYPE_DICT
:
return
action
;
case
ACTION_TYPE_PAGE_CREATE
:
return
decodePageCreateAction
(
action
);
case
ACTION_TYPE_PAGE_CREATED
:
return
decodePageCreatedAction
(
action
);
case
ACTION_TYPE_CREATE
:
return
decodeCreateAction
(
action
,
getDict
);
case
ACTION_TYPE_INSERT
:
return
decodeInsertAction
(
action
,
getDict
);
case
ACTION_TYPE_REMOVE
:
return
decodeRemoveAction
(
action
);
case
ACTION_TYPE_SET_ATTRIBUTE
:
return
decodeSetAttributeAction
(
action
,
getDict
);
case
ACTION_TYPE_REMOVE_ATTRIBUTE
:
return
decodeRemoveAttributeAction
(
action
,
getDict
);
case
ACTION_TYPE_ADD_EVENT
:
return
decodeAddEventAction
(
action
,
getDict
);
case
ACTION_TYPE_ADD_WXS_EVENT
:
return
decodeAddWxsEventAction
(
action
,
getDict
);
case
ACTION_TYPE_REMOVE_EVENT
:
return
decodeRemoveEventAction
(
action
,
getDict
);
case
ACTION_TYPE_SET_TEXT
:
return
decodeSetTextAction
(
action
,
getDict
);
}
});
}
function
decodePageCreateAction
([,
pageCreateData
])
{
return
[
'
pageCreate
'
,
pageCreateData
];
}
function
decodePageCreatedAction
([])
{
return
[
'
pageCreated
'
];
}
function
decodeNodeJson
(
getDict
,
nodeJson
)
{
if
(
!
nodeJson
)
{
return
;
}
if
(
hasOwn
(
nodeJson
,
'
a
'
))
{
nodeJson
.
a
=
getDict
(
nodeJson
.
a
);
}
if
(
hasOwn
(
nodeJson
,
'
e
'
))
{
nodeJson
.
e
=
getDict
(
nodeJson
.
e
,
false
);
}
if
(
hasOwn
(
nodeJson
,
'
w
'
))
{
nodeJson
.
w
=
getWxsEventDict
(
nodeJson
.
w
,
getDict
);
}
if
(
hasOwn
(
nodeJson
,
'
s
'
))
{
nodeJson
.
s
=
getDict
(
nodeJson
.
s
);
}
if
(
hasOwn
(
nodeJson
,
'
t
'
))
{
nodeJson
.
t
=
getDict
(
nodeJson
.
t
);
}
return
nodeJson
;
}
function
getWxsEventDict
(
w
,
getDict
)
{
const
res
=
{};
w
.
forEach
(([
name
,
[
wxsEvent
,
flag
]])
=>
{
res
[
getDict
(
name
)]
=
[
getDict
(
wxsEvent
),
flag
];
});
return
res
;
}
function
decodeCreateAction
([,
nodeId
,
nodeName
,
parentNodeId
,
refNodeId
,
nodeJson
],
getDict
)
{
return
[
'
create
'
,
nodeId
,
getDict
(
nodeName
),
parentNodeId
,
refNodeId
,
decodeNodeJson
(
getDict
,
nodeJson
),
];
}
function
decodeInsertAction
([,
...
action
],
getDict
)
{
return
[
'
insert
'
,
action
[
0
],
action
[
1
],
action
[
2
],
action
[
3
]
?
decodeNodeJson
(
getDict
,
action
[
3
])
:
{},
];
}
function
decodeRemoveAction
([,
...
action
])
{
return
[
'
remove
'
,
...
action
];
}
function
decodeAddEventAction
([,
...
action
],
getDict
)
{
return
[
'
addEvent
'
,
action
[
0
],
getDict
(
action
[
1
]),
action
[
2
]];
}
function
decodeAddWxsEventAction
([,
...
action
],
getDict
)
{
return
[
'
addWxsEvent
'
,
action
[
0
],
getDict
(
action
[
1
]),
getDict
(
action
[
2
]),
action
[
3
],
];
}
function
decodeRemoveEventAction
([,
...
action
],
getDict
)
{
return
[
'
removeEvent
'
,
action
[
0
],
getDict
(
action
[
1
])];
}
function
decodeSetAttributeAction
([,
...
action
],
getDict
)
{
return
[
'
setAttr
'
,
action
[
0
],
getDict
(
action
[
1
]),
getDict
(
action
[
2
]),
];
}
function
decodeRemoveAttributeAction
([,
...
action
],
getDict
)
{
return
[
'
removeAttr
'
,
action
[
0
],
getDict
(
action
[
1
])];
}
function
decodeSetTextAction
([,
...
action
],
getDict
)
{
return
[
'
setText
'
,
action
[
0
],
getDict
(
action
[
1
])];
}
exports
.
createGetDict
=
createGetDict
;
exports
.
decodeActions
=
decodeActions
;
exports
.
decodeNodeJson
=
decodeNodeJson
;
}));
packages/uni-app-plus/dist/uni-app-view.umd.js
已删除
100644 → 0
浏览文件 @
482d634d
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
packages/uni-app-plus/dist/uni.compiler.js
已删除
100644 → 0
浏览文件 @
482d634d
'
use strict
'
;
var
appVite
=
require
(
'
@dcloudio/uni-app-vite
'
);
var
appUVue
=
require
(
'
@dcloudio/uni-app-uts
'
);
function
_interopDefault
(
e
)
{
return
e
&&
e
.
__esModule
?
e
:
{
default
:
e
};
}
var
appVite__default
=
/*#__PURE__*/
_interopDefault
(
appVite
);
var
appUVue__default
=
/*#__PURE__*/
_interopDefault
(
appUVue
);
var
index
=
[
process
.
env
.
UNI_APP_X
===
'
true
'
?
appUVue__default
.
default
:
appVite__default
.
default
];
module
.
exports
=
index
;
packages/uni-app-plus/dist/uni.runtime.esm.js
已删除
100644 → 0
浏览文件 @
482d634d
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/uni.vue.js
已删除
100644 → 0
浏览文件 @
482d634d
import
{
invokeArrayFns
,
isUniLifecycleHook
,
ON_LOAD
,
ON_SHOW
,
LINEFEED
,
RENDERJS_MODULES
,
formatLog
,
WXS_PROTOCOL
,
WXS_MODULES
,
UniLifecycleHooks
,
ON_ERROR
,
invokeCreateErrorHandler
,
invokeCreateVueAppHook
}
from
'
@dcloudio/uni-shared
'
;
import
{
isString
,
isArray
,
isFunction
}
from
'
@vue/shared
'
;
import
{
injectHook
}
from
'
vue
'
;
function
getCurrentPage
()
{
const
pages
=
getCurrentPages
();
const
len
=
pages
.
length
;
if
(
len
)
{
return
pages
[
len
-
1
];
}
}
function
getCurrentPageVm
()
{
const
page
=
getCurrentPage
();
if
(
page
)
{
return
page
.
$vm
;
}
}
function
invokeHook
(
vm
,
name
,
args
)
{
if
(
isString
(
vm
))
{
args
=
name
;
name
=
vm
;
vm
=
getCurrentPageVm
();
}
else
if
(
typeof
vm
===
'
number
'
)
{
const
page
=
getCurrentPages
().
find
((
page
)
=>
page
.
$page
.
id
===
vm
);
if
(
page
)
{
vm
=
page
.
$vm
;
}
else
{
vm
=
getCurrentPageVm
();
}
}
if
(
!
vm
)
{
return
;
}
// 兼容 nvue
{
if
(
vm
.
__call_hook
)
{
return
vm
.
__call_hook
(
name
,
args
);
}
}
const
hooks
=
vm
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
}
function
injectLifecycleHook
(
name
,
hook
,
publicThis
,
instance
)
{
if
(
isFunction
(
hook
))
{
injectHook
(
name
,
hook
.
bind
(
publicThis
),
instance
);
}
}
function
initHooks
(
options
,
instance
,
publicThis
)
{
var
_a
;
const
mpType
=
options
.
mpType
||
publicThis
.
$mpType
;
if
(
!
mpType
||
mpType
===
'
component
'
)
{
// 仅 App,Page 类型支持在 options 中配置 on 生命周期,组件可以使用组合式 API 定义页面生命周期
return
;
}
Object
.
keys
(
options
).
forEach
((
name
)
=>
{
if
(
isUniLifecycleHook
(
name
,
options
[
name
],
false
))
{
const
hooks
=
options
[
name
];
if
(
isArray
(
hooks
))
{
hooks
.
forEach
((
hook
)
=>
injectLifecycleHook
(
name
,
hook
,
publicThis
,
instance
));
}
else
{
injectLifecycleHook
(
name
,
hooks
,
publicThis
,
instance
);
}
}
});
if
(
mpType
===
'
page
'
)
{
instance
.
__isVisible
=
true
;
// 直接触发页面 onLoad、onShow 组件内的 onLoad 和 onShow 在注册时,直接触发一次
try
{
invokeHook
(
publicThis
,
ON_LOAD
,
instance
.
attrs
.
__pageQuery
);
delete
instance
.
attrs
.
__pageQuery
;
if
(((
_a
=
publicThis
.
$page
)
===
null
||
_a
===
void
0
?
void
0
:
_a
.
openType
)
!==
'
preloadPage
'
)
{
invokeHook
(
publicThis
,
ON_SHOW
);
}
}
catch
(
e
)
{
console
.
error
(
e
.
message
+
LINEFEED
+
e
.
stack
);
}
}
}
function
initRenderjs
(
options
,
instance
)
{
initModules
(
instance
,
options
.
$renderjs
,
options
[
'
$
'
+
RENDERJS_MODULES
]);
}
function
initModules
(
instance
,
modules
,
moduleIds
=
{})
{
if
(
!
isArray
(
modules
))
{
return
;
}
const
ownerId
=
instance
.
uid
;
// 在vue的定制内核中,通过$wxsModules来判断事件函数源码中是否包含该模块调用
// !$wxsModules.find(module => invokerSourceCode.indexOf('.' + module + '.') > -1)
const
$wxsModules
=
(
instance
.
$wxsModules
||
(
instance
.
$wxsModules
=
[]));
const
ctx
=
instance
.
ctx
;
modules
.
forEach
((
module
)
=>
{
if
(
moduleIds
[
module
])
{
ctx
[
module
]
=
proxyModule
(
ownerId
,
moduleIds
[
module
],
module
);
$wxsModules
.
push
(
module
);
}
else
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
console
.
error
(
formatLog
(
'
initModules
'
,
modules
,
moduleIds
));
}
}
});
}
function
proxyModule
(
ownerId
,
moduleId
,
module
)
{
const
target
=
{};
return
new
Proxy
(
target
,
{
get
(
_
,
p
)
{
return
(
target
[
p
]
||
(
target
[
p
]
=
createModuleFunction
(
ownerId
,
moduleId
,
module
,
p
)));
},
});
}
function
createModuleFunction
(
ownerId
,
moduleId
,
module
,
name
)
{
const
target
=
()
=>
{
};
const
toJSON
=
()
=>
WXS_PROTOCOL
+
JSON
.
stringify
([
ownerId
,
moduleId
,
module
+
'
.
'
+
name
]);
return
new
Proxy
(
target
,
{
get
(
_
,
p
)
{
if
(
p
===
'
toJSON
'
)
{
return
toJSON
;
}
return
(
target
[
p
]
||
(
target
[
p
]
=
createModuleFunction
(
ownerId
,
moduleId
,
module
+
'
.
'
+
name
,
p
)));
},
apply
(
_target
,
_thisArg
,
args
)
{
return
(
WXS_PROTOCOL
+
JSON
.
stringify
([
ownerId
,
moduleId
,
module
+
'
.
'
+
name
,
[...
args
]]));
},
});
}
function
initWxs
(
options
,
instance
)
{
initModules
(
instance
,
options
.
$wxs
,
options
[
'
$
'
+
WXS_MODULES
]);
}
function
applyOptions
(
options
,
instance
,
publicThis
)
{
{
initWxs
(
options
,
instance
);
initRenderjs
(
options
,
instance
);
}
initHooks
(
options
,
instance
,
publicThis
);
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
$callMethod
(
method
,
...
args
)
{
const
fn
=
this
[
method
];
if
(
fn
)
{
return
fn
(...
args
);
}
console
.
error
(
`method
${
method
}
not found`
);
return
null
;
}
function
createErrorHandler
(
app
)
{
return
function
errorHandler
(
err
,
instance
,
_info
)
{
if
(
!
instance
)
{
throw
err
;
}
const
appInstance
=
app
.
_instance
;
if
(
!
appInstance
||
!
appInstance
.
proxy
)
{
throw
err
;
}
{
invokeHook
(
appInstance
.
proxy
,
ON_ERROR
,
err
);
}
};
}
function
mergeAsArray
(
to
,
from
)
{
return
to
?
[...
new
Set
([].
concat
(
to
,
from
))]
:
from
;
}
function
initOptionMergeStrategies
(
optionMergeStrategies
)
{
UniLifecycleHooks
.
forEach
((
name
)
=>
{
optionMergeStrategies
[
name
]
=
mergeAsArray
;
});
}
let
realAtob
;
const
b64
=
'
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
'
;
const
b64re
=
/^
(?:[
A-Za-z
\d
+
/]{4})
*
?(?:[
A-Za-z
\d
+
/]{2}(?:
==
)?
|
[
A-Za-z
\d
+
/]{3}
=
?)?
$/
;
if
(
typeof
atob
!==
'
function
'
)
{
realAtob
=
function
(
str
)
{
str
=
String
(
str
).
replace
(
/
[\t\n\f\r
]
+/g
,
''
);
if
(
!
b64re
.
test
(
str
))
{
throw
new
Error
(
"
Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
"
);
}
// Adding the padding if missing, for semplicity
str
+=
'
==
'
.
slice
(
2
-
(
str
.
length
&
3
));
var
bitmap
;
var
result
=
''
;
var
r1
;
var
r2
;
var
i
=
0
;
for
(;
i
<
str
.
length
;)
{
bitmap
=
(
b64
.
indexOf
(
str
.
charAt
(
i
++
))
<<
18
)
|
(
b64
.
indexOf
(
str
.
charAt
(
i
++
))
<<
12
)
|
((
r1
=
b64
.
indexOf
(
str
.
charAt
(
i
++
)))
<<
6
)
|
(
r2
=
b64
.
indexOf
(
str
.
charAt
(
i
++
)));
result
+=
r1
===
64
?
String
.
fromCharCode
((
bitmap
>>
16
)
&
255
)
:
r2
===
64
?
String
.
fromCharCode
((
bitmap
>>
16
)
&
255
,
(
bitmap
>>
8
)
&
255
)
:
String
.
fromCharCode
((
bitmap
>>
16
)
&
255
,
(
bitmap
>>
8
)
&
255
,
bitmap
&
255
);
}
return
result
;
};
}
else
{
// 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
realAtob
=
atob
;
}
function
b64DecodeUnicode
(
str
)
{
return
decodeURIComponent
(
realAtob
(
str
)
.
split
(
''
)
.
map
(
function
(
c
)
{
return
'
%
'
+
(
'
00
'
+
c
.
charCodeAt
(
0
).
toString
(
16
)).
slice
(
-
2
);
})
.
join
(
''
));
}
function
getCurrentUserInfo
()
{
const
token
=
uni
.
getStorageSync
(
'
uni_id_token
'
)
||
''
;
const
tokenArr
=
token
.
split
(
'
.
'
);
if
(
!
token
||
tokenArr
.
length
!==
3
)
{
return
{
uid
:
null
,
role
:
[],
permission
:
[],
tokenExpired
:
0
,
};
}
let
userInfo
;
try
{
userInfo
=
JSON
.
parse
(
b64DecodeUnicode
(
tokenArr
[
1
]));
}
catch
(
error
)
{
throw
new
Error
(
'
获取当前用户信息出错,详细错误信息为:
'
+
error
.
message
);
}
userInfo
.
tokenExpired
=
userInfo
.
exp
*
1000
;
delete
userInfo
.
exp
;
delete
userInfo
.
iat
;
return
userInfo
;
}
function
uniIdMixin
(
globalProperties
)
{
globalProperties
.
uniIDHasRole
=
function
(
roleId
)
{
const
{
role
}
=
getCurrentUserInfo
();
return
role
.
indexOf
(
roleId
)
>
-
1
;
};
globalProperties
.
uniIDHasPermission
=
function
(
permissionId
)
{
const
{
permission
}
=
getCurrentUserInfo
();
return
this
.
uniIDHasRole
(
'
admin
'
)
||
permission
.
indexOf
(
permissionId
)
>
-
1
;
};
globalProperties
.
uniIDTokenValid
=
function
()
{
const
{
tokenExpired
}
=
getCurrentUserInfo
();
return
tokenExpired
>
Date
.
now
();
};
}
function
initApp
(
app
)
{
const
appConfig
=
app
.
_context
.
config
;
appConfig
.
errorHandler
=
invokeCreateErrorHandler
(
app
,
createErrorHandler
);
initOptionMergeStrategies
(
appConfig
.
optionMergeStrategies
);
const
globalProperties
=
appConfig
.
globalProperties
;
{
uniIdMixin
(
globalProperties
);
}
{
globalProperties
.
$set
=
set
;
globalProperties
.
$applyOptions
=
applyOptions
;
globalProperties
.
$callMethod
=
$callMethod
;
}
{
invokeCreateVueAppHook
(
app
);
}
}
export
{
initApp
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录