Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenYFan_OHHH
uni-app
提交
3928e364
U
uni-app
项目概览
ChenYFan_OHHH
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3928e364
编写于
5月 25, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: add resolveEasycom
上级
0838634f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
42 addition
and
11 deletion
+42
-11
packages/shims-uni-app.d.ts
packages/shims-uni-app.d.ts
+1
-0
packages/uni-app/dist/uni-app.cjs.js
packages/uni-app/dist/uni-app.cjs.js
+5
-0
packages/uni-app/dist/uni-app.d.ts
packages/uni-app/dist/uni-app.d.ts
+2
-0
packages/uni-app/dist/uni-app.es.js
packages/uni-app/dist/uni-app.es.js
+6
-2
packages/uni-app/src/index.ts
packages/uni-app/src/index.ts
+1
-0
packages/uni-app/src/utils.ts
packages/uni-app/src/utils.ts
+5
-0
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+1
-1
packages/uni-h5/src/framework/components/layout/index.tsx
packages/uni-h5/src/framework/components/layout/index.tsx
+2
-1
packages/vite-plugin-uni/src/configResolved/plugins/easycom.ts
...ges/vite-plugin-uni/src/configResolved/plugins/easycom.ts
+18
-6
未找到文件。
packages/shims-uni-app.d.ts
浏览文件 @
3928e364
...
...
@@ -152,6 +152,7 @@ declare namespace UniApp {
topWindow
?:
boolean
leftWindow
?:
boolean
rightWindow
?:
boolean
maxWidth
?:
string
|
number
}
interface
PagesJsonPageOptions
{
...
...
packages/uni-app/dist/uni-app.cjs.js
浏览文件 @
3928e364
...
...
@@ -76,6 +76,10 @@ function getSsrGlobalData() {
return
sanitise
(
globalData
);
}
function
resolveEasycom
(
component
,
easycom
)
{
return
shared
.
isString
(
component
)
?
easycom
:
component
;
}
// @ts-ignore
// App and Page
const
ON_SHOW
=
'
onShow
'
;
...
...
@@ -155,5 +159,6 @@ exports.onTabItemTap = onTabItemTap;
exports
.
onThemeChange
=
onThemeChange
;
exports
.
onUnhandledRejection
=
onUnhandledRejection
;
exports
.
onUnload
=
onUnload
;
exports
.
resolveEasycom
=
resolveEasycom
;
exports
.
shallowSsrRef
=
shallowSsrRef
;
exports
.
ssrRef
=
ssrRef
;
packages/uni-app/dist/uni-app.d.ts
浏览文件 @
3928e364
...
...
@@ -50,6 +50,8 @@ export declare const onUnhandledRejection: (hook: () => any, target?: ComponentI
export
declare
const
onUnload
:
(
hook
:
()
=>
any
,
target
?:
ComponentInternalInstance
|
null
)
=>
any
;
export
declare
function
resolveEasycom
(
component
:
unknown
,
easycom
:
unknown
):
unknown
;
export
declare
const
shallowSsrRef
:
SSRRef
;
declare
type
SSRRef
=
(
value
:
unknown
,
key
?:
string
,
shallow
?:
boolean
)
=>
ReturnType
<
typeof
ref
>
|
ReturnType
<
typeof
shallowRef
>
;
...
...
packages/uni-app/dist/uni-app.es.js
浏览文件 @
3928e364
import
{
shallowRef
,
ref
,
getCurrentInstance
,
isInSSRComponentSetup
,
injectHook
}
from
'
vue
'
;
import
{
hasOwn
}
from
'
@vue/shared
'
;
import
{
hasOwn
,
isString
}
from
'
@vue/shared
'
;
const
sanitise
=
(
val
)
=>
(
val
&&
JSON
.
parse
(
JSON
.
stringify
(
val
)))
||
val
;
const
UNI_SSR
=
'
__uniSSR
'
;
...
...
@@ -41,6 +41,10 @@ function getSsrGlobalData() {
return
sanitise
(
globalData
);
}
function
resolveEasycom
(
component
,
easycom
)
{
return
isString
(
component
)
?
easycom
:
component
;
}
// @ts-ignore
// App and Page
const
ON_SHOW
=
'
onShow
'
;
...
...
@@ -96,4 +100,4 @@ const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(ON_NAVIGATION
const
onNavigationBarSearchInputConfirmed
=
/*#__PURE__*/
createHook
(
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
);
const
onNavigationBarSearchInputFocusChanged
=
/*#__PURE__*/
createHook
(
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
);
export
{
getSsrGlobalData
,
onAddToFavorites
,
onBackPress
,
onError
,
onHide
,
onLaunch
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onResize
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
shallowSsrRef
,
ssrRef
};
export
{
getSsrGlobalData
,
onAddToFavorites
,
onBackPress
,
onError
,
onHide
,
onLaunch
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onResize
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
resolveEasycom
,
shallowSsrRef
,
ssrRef
};
packages/uni-app/src/index.ts
浏览文件 @
3928e364
export
*
from
'
./ssr
'
export
*
from
'
./utils
'
export
*
from
'
./apiLifecycle
'
packages/uni-app/src/utils.ts
0 → 100644
浏览文件 @
3928e364
import
{
isString
}
from
'
@vue/shared
'
export
function
resolveEasycom
(
component
:
unknown
,
easycom
:
unknown
)
{
return
isString
(
component
)
?
easycom
:
component
}
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
3928e364
...
...
@@ -10617,7 +10617,7 @@ function initMediaQuery(minWidth, callback) {
return
mediaQueryList
.
matches
;
}
function
useMaxWidth
(
layoutState
,
rootRef
)
{
const
route
=
vueRouter
.
us
eRoute
();
const
route
=
usePag
eRoute
();
function
checkMaxWidth
()
{
const
windowWidth
=
document
.
body
.
clientWidth
;
const
maxWidth
=
parseInt
(
String
(
route
.
meta
.
maxWidth
||
1190
));
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
3928e364
...
...
@@ -18101,7 +18101,7 @@ function initMediaQuery(minWidth, callback) {
return mediaQueryList.matches;
}
function useMaxWidth(layoutState, rootRef) {
const route = useRoute();
const route = use
Page
Route();
function checkMaxWidth() {
const windowWidth = document.body.clientWidth;
const maxWidth = parseInt(String(route.meta.maxWidth || 1190));
...
...
packages/uni-h5/src/framework/components/layout/index.tsx
浏览文件 @
3928e364
...
...
@@ -29,6 +29,7 @@ import { checkMinWidth } from '../../../helpers/dom'
import
{
hasOwn
}
from
'
@vue/shared
'
import
TabBar
from
'
./tabBar
'
import
{
usePageRoute
}
from
'
../../setup/provide
'
type
KeepAliveRoute
=
ReturnType
<
typeof
useKeepAliveRoute
>
...
...
@@ -140,7 +141,7 @@ function useMaxWidth(
layoutState
:
LayoutState
,
rootRef
:
Ref
<
HTMLElement
|
null
>
)
{
const
route
=
useRoute
()
const
route
=
use
Page
Route
()
function
checkMaxWidth
()
{
const
windowWidth
=
document
.
body
.
clientWidth
const
maxWidth
=
parseInt
(
String
(
route
.
meta
.
maxWidth
||
1190
))
...
...
packages/vite-plugin-uni/src/configResolved/plugins/easycom.ts
浏览文件 @
3928e364
...
...
@@ -50,7 +50,7 @@ const baseComponents = [
'
view
'
,
]
const
identifierRE
=
/^
([
a-zA-Z_$
][
a-zA-Z
\\
d_$
]
*
)
$/
//
const identifierRE = /^([a-zA-Z_$][a-zA-Z\\d_$]*)$/
export
function
uniEasycomPlugin
(
options
:
UniPluginFilterOptions
,
...
...
@@ -100,11 +100,10 @@ export function uniEasycomPlugin(
}
const
source
=
matchEasycom
(
name
)
if
(
source
)
{
return
(
// 解决局部引入组件优先级(理论上让开发者使用script setup就可以解决局部引入)
(
identifierRE
.
test
(
name
)
?
`typeof
${
name
}
!== 'undefined' ?
${
name
}
: `
:
''
)
+
// 处理easycom组件优先级
return
genResolveEasycomCode
(
importDeclarations
,
str
,
addImportDeclaration
(
importDeclarations
,
`__easycom_
${
i
++
}
`
,
...
...
@@ -124,6 +123,19 @@ export function uniEasycomPlugin(
}
}
const
RESOLVE_EASYCOM_IMPORT_CODE
=
`import { resolveEasycom } from '@dcloudio/uni-app';`
function
genResolveEasycomCode
(
importDeclarations
:
string
[],
code
:
string
,
name
:
string
)
{
if
(
!
importDeclarations
.
includes
(
RESOLVE_EASYCOM_IMPORT_CODE
))
{
importDeclarations
.
push
(
RESOLVE_EASYCOM_IMPORT_CODE
)
}
return
`resolveEasycom(
${
code
}
,
${
name
}
)`
}
function
resolveBuiltInCssImport
(
name
:
string
)
{
const
cssImports
:
string
[]
=
[]
if
(
baseComponents
.
includes
(
name
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录