Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenYFan_OHHH
uni-app
提交
81329b2e
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,发现更多精彩内容 >>
提交
81329b2e
编写于
10月 10, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(mp): render
上级
9d004089
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
199 addition
and
171 deletion
+199
-171
packages/uni-app-plus/dist/tools.umd.js
packages/uni-app-plus/dist/tools.umd.js
+2
-2
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+5
-5
packages/uni-app-vue/dist/service.runtime.esm.dev.js
packages/uni-app-vue/dist/service.runtime.esm.dev.js
+4
-4
packages/uni-app-vue/dist/service.runtime.esm.prod.js
packages/uni-app-vue/dist/service.runtime.esm.prod.js
+3
-3
packages/uni-app-vue/dist/view.runtime.esm.js
packages/uni-app-vue/dist/view.runtime.esm.js
+5
-5
packages/uni-mp-alipay/build.json
packages/uni-mp-alipay/build.json
+0
-1
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+1
-1
packages/uni-mp-alipay/src/runtime/index.ts
packages/uni-mp-alipay/src/runtime/index.ts
+1
-1
packages/uni-mp-baidu/build.json
packages/uni-mp-baidu/build.json
+0
-1
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+1
-1
packages/uni-mp-baidu/src/runtime/index.ts
packages/uni-mp-baidu/src/runtime/index.ts
+1
-1
packages/uni-mp-kuaishou/build.json
packages/uni-mp-kuaishou/build.json
+0
-1
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+2
-2
packages/uni-mp-kuaishou/src/runtime/index.ts
packages/uni-mp-kuaishou/src/runtime/index.ts
+1
-1
packages/uni-mp-qq/build.json
packages/uni-mp-qq/build.json
+0
-1
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+2
-2
packages/uni-mp-qq/src/runtime/index.ts
packages/uni-mp-qq/src/runtime/index.ts
+1
-1
packages/uni-mp-toutiao/build.json
packages/uni-mp-toutiao/build.json
+0
-1
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+1
-1
packages/uni-mp-toutiao/src/runtime/index.ts
packages/uni-mp-toutiao/src/runtime/index.ts
+1
-1
packages/uni-mp-vite/src/index.ts
packages/uni-mp-vite/src/index.ts
+1
-1
packages/uni-mp-vite/src/plugins/mainJs.ts
packages/uni-mp-vite/src/plugins/mainJs.ts
+4
-9
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+59
-54
packages/uni-mp-vue/lib/vue.runtime.esm.js
packages/uni-mp-vue/lib/vue.runtime.esm.js
+56
-50
packages/uni-mp-vue/src/plugin.ts
packages/uni-mp-vue/src/plugin.ts
+1
-2
packages/uni-mp-weixin/build.json
packages/uni-mp-weixin/build.json
+0
-1
packages/uni-mp-weixin/dist/uni.compiler.js
packages/uni-mp-weixin/dist/uni.compiler.js
+18
-5
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+1
-1
packages/uni-mp-weixin/src/plugin/index.ts
packages/uni-mp-weixin/src/plugin/index.ts
+22
-7
packages/uni-mp-weixin/src/runtime/index.ts
packages/uni-mp-weixin/src/runtime/index.ts
+1
-1
packages/uni-quickapp-webview/build.json
packages/uni-quickapp-webview/build.json
+0
-1
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+1
-1
packages/uni-quickapp-webview/src/runtime/index.ts
packages/uni-quickapp-webview/src/runtime/index.ts
+1
-1
rollup.config.js
rollup.config.js
+3
-1
未找到文件。
packages/uni-app-plus/dist/tools.umd.js
浏览文件 @
81329b2e
(
function
(
window
,
factory
)
{
(
function
(
global
,
factory
)
{
typeof
exports
===
'
object
'
&&
typeof
module
!==
'
undefined
'
?
factory
(
exports
)
:
typeof
define
===
'
function
'
&&
define
.
amd
?
define
([
'
exports
'
],
factory
)
:
(
global
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
window
||
self
,
factory
(
window
.
Tools
=
{}));
(
global
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
global
||
self
,
factory
(
global
.
Tools
=
{}));
})(
this
,
(
function
(
exports
)
{
'
use strict
'
;
const
ACTION_TYPE_PAGE_CREATE
=
1
;
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
81329b2e
...
...
@@ -1501,9 +1501,9 @@ var serviceContext = (function (vue) {
if (typeof uni !== 'undefined' && uni.getLocale) {
return uni.getLocale();
}
// 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在
window
上挂了 getLocale
if (typeof
window !== 'undefined' && window
.getLocale) {
return
window
.getLocale();
// 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在
global
上挂了 getLocale
if (typeof
global !== 'undefined' && global
.getLocale) {
return
global
.getLocale();
}
return LOCALE_EN;
}
...
...
@@ -11996,7 +11996,7 @@ var serviceContext = (function (vue) {
plus = newPlus;
restoreOldSetStatusBarStyle(plus.navigator.setStatusBarStyle);
plus.navigator.setStatusBarStyle = newSetStatusBarStyle;
/* eslint-disable no-
window
-assign */
/* eslint-disable no-
global
-assign */
// @ts-ignore
setTimeout = newSetTimeout;
// @ts-ignore
...
...
@@ -13238,7 +13238,7 @@ var serviceContext = (function (vue) {
// do check in _tr_init()
//if (static_init_done) return;
/* For some embedded targets,
window
variables are not initialized: */
/* For some embedded targets,
global
variables are not initialized: */
/*#ifdef NO_INIT_GLOBAL_POINTERS
static_l_desc.static_tree = static_ltree;
static_l_desc.extra_bits = extra_lbits;
...
...
packages/uni-app-vue/dist/service.runtime.esm.dev.js
浏览文件 @
81329b2e
...
...
@@ -895,7 +895,7 @@ export default function vueFactory(exports) {
var
_globalThis
;
var
getGlobalThis
=
()
=>
{
return
_globalThis
||
(
_globalThis
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
typeof
self
!==
'
undefined
'
?
self
:
typeof
window
!==
'
undefined
'
?
window
:
typeof
window
!==
'
undefined
'
?
window
:
{});
return
_globalThis
||
(
_globalThis
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
typeof
self
!==
'
undefined
'
?
self
:
typeof
window
!==
'
undefined
'
?
window
:
typeof
global
!==
'
undefined
'
?
global
:
{});
};
function
warn
(
msg
,
...
args
)
{
...
...
@@ -2315,7 +2315,7 @@ export default function vueFactory(exports) {
var
isHmrUpdating
=
false
;
var
hmrDirtyComponents
=
new
Set
();
// Expose the HMR runtime on the
window
object
var
hmrDirtyComponents
=
new
Set
();
// Expose the HMR runtime on the
global
object
// This makes it entirely tree-shakable without polluting the exports and makes
// it easier to be used in toolings like vue-loader
// Note: for a component to be eligible for HMR it also needs the __hmrId option
...
...
@@ -8669,7 +8669,7 @@ export default function vueFactory(exports) {
var
res
=
// local registration
// check instance[type] first which is resolved for options API
resolve
(
instance
[
type
]
||
Component
[
type
],
name
)
||
//
window
registration
resolve
(
instance
[
type
]
||
Component
[
type
],
name
)
||
//
global
registration
resolve
(
instance
.
appContext
[
type
],
name
);
if
(
!
res
&&
maybeSelfReference
)
{
...
...
@@ -9528,7 +9528,7 @@ export default function vueFactory(exports) {
/* CONTEXT */
;
return
ctx
[
key
];
}
else
if
(
//
window
properties
}
else
if
(
//
global
properties
globalProperties
=
appContext
.
config
.
globalProperties
,
hasOwn
(
globalProperties
,
key
))
{
{
return
globalProperties
[
key
];
...
...
packages/uni-app-vue/dist/service.runtime.esm.prod.js
浏览文件 @
81329b2e
...
...
@@ -874,7 +874,7 @@ export default function vueFactory(exports) {
var
_globalThis
;
var
getGlobalThis
=
()
=>
{
return
_globalThis
||
(
_globalThis
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
typeof
self
!==
'
undefined
'
?
self
:
typeof
window
!==
'
undefined
'
?
window
:
typeof
window
!==
'
undefined
'
?
window
:
{});
return
_globalThis
||
(
_globalThis
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
typeof
self
!==
'
undefined
'
?
self
:
typeof
window
!==
'
undefined
'
?
window
:
typeof
global
!==
'
undefined
'
?
global
:
{});
};
var
activeEffectScope
;
...
...
@@ -7495,7 +7495,7 @@ export default function vueFactory(exports) {
var
res
=
// local registration
// check instance[type] first which is resolved for options API
resolve
(
instance
[
type
]
||
Component
[
type
],
name
)
||
//
window
registration
resolve
(
instance
[
type
]
||
Component
[
type
],
name
)
||
//
global
registration
resolve
(
instance
.
appContext
[
type
],
name
);
if
(
!
res
&&
maybeSelfReference
)
{
...
...
@@ -8268,7 +8268,7 @@ export default function vueFactory(exports) {
/* CONTEXT */
;
return
ctx
[
key
];
}
else
if
(
//
window
properties
}
else
if
(
//
global
properties
globalProperties
=
appContext
.
config
.
globalProperties
,
hasOwn
(
globalProperties
,
key
))
{
{
return
globalProperties
[
key
];
...
...
packages/uni-app-vue/dist/view.runtime.esm.js
浏览文件 @
81329b2e
...
...
@@ -326,8 +326,8 @@ const getGlobalThis = () => {
?
self
:
typeof
window
!==
'
undefined
'
?
window
:
typeof
window
!==
'
undefined
'
?
window
:
typeof
global
!==
'
undefined
'
?
global
:
{}));
};
...
...
@@ -1449,7 +1449,7 @@ function computed(getterOrOptions, debugOptions) {
/* eslint-disable no-restricted-globals */
let
isHmrUpdating
=
false
;
const
hmrDirtyComponents
=
new
Set
();
// Expose the HMR runtime on the
window
object
// Expose the HMR runtime on the
global
object
// This makes it entirely tree-shakable without polluting the exports and makes
// it easier to be used in toolings like vue-loader
// Note: for a component to be eligible for HMR it also needs the __hmrId option
...
...
@@ -6686,7 +6686,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
// local registration
// check instance[type] first which is resolved for options API
resolve
(
instance
[
type
]
||
Component
[
type
],
name
)
||
//
window
registration
//
global
registration
resolve
(
instance
.
appContext
[
type
],
name
);
if
(
!
res
&&
maybeSelfReference
)
{
// fallback to implicit self-reference
...
...
@@ -7422,7 +7422,7 @@ const PublicInstanceProxyHandlers = {
return
ctx
[
key
];
}
else
if
(
//
window
properties
//
global
properties
((
globalProperties
=
appContext
.
config
.
globalProperties
),
hasOwn
(
globalProperties
,
key
)))
{
{
...
...
packages/uni-mp-alipay/build.json
浏览文件 @
81329b2e
...
...
@@ -16,7 +16,6 @@
]
},
"replacements"
:
{
"global"
:
"global"
,
"__GLOBAL__"
:
"my"
,
"__PLATFORM__"
:
"
\"
mp-alipay
\"
"
,
"__PLATFORM_TITLE__"
:
"支付宝小程序"
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
81329b2e
...
...
@@ -1435,7 +1435,7 @@ function createComponent$1(vueOptions) {
const
createApp
=
initCreateApp
(
parseAppOptions
);
my
.
EventChannel
=
EventChannel
;
my
.
createApp
=
createApp
;
my
.
createApp
=
global
.
createApp
=
createApp
;
my
.
createPage
=
createPage
;
my
.
createComponent
=
createComponent
;
...
...
packages/uni-mp-alipay/src/runtime/index.ts
浏览文件 @
81329b2e
...
...
@@ -9,6 +9,6 @@ export { createComponent } from './createComponent'
export
const
createApp
=
initCreateApp
(
parseAppOptions
)
;(
my
as
any
).
EventChannel
=
EventChannel
;(
my
as
any
).
createApp
=
createApp
;(
my
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
my
as
any
).
createPage
=
createPage
;(
my
as
any
).
createComponent
=
createComponent
packages/uni-mp-baidu/build.json
浏览文件 @
81329b2e
...
...
@@ -16,7 +16,6 @@
]
},
"replacements"
:
{
"global"
:
"global"
,
"__GLOBAL__"
:
"swan"
,
"__PLATFORM__"
:
"
\"
mp-baidu
\"
"
,
"__PLATFORM_TITLE__"
:
"百度小程序"
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
81329b2e
...
...
@@ -1396,7 +1396,7 @@ const createApp = initCreateApp(parseAppOptions);
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
swan
.
EventChannel
=
EventChannel
;
swan
.
createApp
=
createApp
;
swan
.
createApp
=
global
.
createApp
=
createApp
;
swan
.
createPage
=
createPage
;
swan
.
createComponent
=
createComponent
;
...
...
packages/uni-mp-baidu/src/runtime/index.ts
浏览文件 @
81329b2e
...
...
@@ -15,6 +15,6 @@ export const createApp = initCreateApp(parseAppOptions)
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
;(
swan
as
any
).
EventChannel
=
EventChannel
;(
swan
as
any
).
createApp
=
createApp
;(
swan
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
swan
as
any
).
createPage
=
createPage
;(
swan
as
any
).
createComponent
=
createComponent
packages/uni-mp-kuaishou/build.json
浏览文件 @
81329b2e
...
...
@@ -16,7 +16,6 @@
]
},
"replacements"
:
{
"global"
:
"global"
,
"__GLOBAL__"
:
"ks"
,
"__PLATFORM__"
:
"
\"
mp-kuaishou
\"
"
,
"__PLATFORM_TITLE__"
:
"快手小程序"
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
81329b2e
...
...
@@ -1232,7 +1232,7 @@ var baseParseOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
baseParseOptions
);
const
createComponent$1
=
initCreateComponent
(
baseParseOptions
);
wx
.
createApp
=
createApp
;
wx
.
createApp
=
global
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent$1
;
...
...
@@ -1295,7 +1295,7 @@ var parseComponentOptions = extend({}, baseParseOptions, {
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
ks
.
EventChannel
=
EventChannel
;
ks
.
createApp
=
createApp
;
ks
.
createApp
=
global
.
createApp
=
createApp
;
ks
.
createPage
=
createPage
;
ks
.
createComponent
=
createComponent
;
...
...
packages/uni-mp-kuaishou/src/runtime/index.ts
浏览文件 @
81329b2e
...
...
@@ -7,6 +7,6 @@ import parseComponentOptions from './parseComponentOptions'
export
{
createApp
,
createPage
}
from
'
@dcloudio/uni-mp-weixin/src/runtime
'
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
;(
ks
as
any
).
EventChannel
=
EventChannel
;(
ks
as
any
).
createApp
=
createApp
;(
ks
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
ks
as
any
).
createPage
=
createPage
;(
ks
as
any
).
createComponent
=
createComponent
packages/uni-mp-qq/build.json
浏览文件 @
81329b2e
...
...
@@ -16,7 +16,6 @@
]
},
"replacements"
:
{
"global"
:
"global"
,
"__GLOBAL__"
:
"qq"
,
"__PLATFORM__"
:
"
\"
mp-qq
\"
"
,
"__PLATFORM_TITLE__"
:
"QQ小程序"
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
81329b2e
...
...
@@ -1232,12 +1232,12 @@ var parseOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parseOptions
);
const
createComponent
=
initCreateComponent
(
parseOptions
);
wx
.
createApp
=
createApp
;
wx
.
createApp
=
global
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent
;
qq
.
EventChannel
=
EventChannel
;
qq
.
createApp
=
createApp
;
qq
.
createApp
=
global
.
createApp
=
createApp
;
qq
.
createPage
=
createPage
;
qq
.
createComponent
=
createComponent
;
...
...
packages/uni-mp-qq/src/runtime/index.ts
浏览文件 @
81329b2e
...
...
@@ -7,6 +7,6 @@ import {
export
*
from
'
@dcloudio/uni-mp-weixin/src/runtime
'
;(
qq
as
any
).
EventChannel
=
EventChannel
;(
qq
as
any
).
createApp
=
createApp
;(
qq
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
qq
as
any
).
createPage
=
createPage
;(
qq
as
any
).
createComponent
=
createComponent
packages/uni-mp-toutiao/build.json
浏览文件 @
81329b2e
...
...
@@ -16,7 +16,6 @@
]
},
"replacements"
:
{
"global"
:
"global"
,
"__GLOBAL__"
:
"tt"
,
"__PLATFORM__"
:
"
\"
mp-toutiao
\"
"
,
"__PLATFORM_TITLE__"
:
"字节跳动小程序"
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
81329b2e
...
...
@@ -1392,7 +1392,7 @@ const createApp = initCreateApp();
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
tt
.
EventChannel
=
EventChannel
;
tt
.
createApp
=
createApp
;
tt
.
createApp
=
global
.
createApp
=
createApp
;
tt
.
createPage
=
createPage
;
tt
.
createComponent
=
createComponent
;
...
...
packages/uni-mp-toutiao/src/runtime/index.ts
浏览文件 @
81329b2e
...
...
@@ -14,6 +14,6 @@ export const createApp = initCreateApp()
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
;(
tt
as
any
).
EventChannel
=
EventChannel
;(
tt
as
any
).
createApp
=
createApp
;(
tt
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
tt
as
any
).
createPage
=
createPage
;(
tt
as
any
).
createComponent
=
createComponent
packages/uni-mp-vite/src/index.ts
浏览文件 @
81329b2e
...
...
@@ -5,7 +5,7 @@ import { uniPagesJsonPlugin } from './plugins/pagesJson'
import
{
uniVirtualPlugin
}
from
'
./plugins/virtual
'
export
default
(
options
:
UniMiniProgramPluginOptions
)
=>
{
return
[
uniMainJsPlugin
(),
uniMainJsPlugin
(
options
),
uniManifestJsonPlugin
(),
uniPagesJsonPlugin
(),
uniVirtualPlugin
(
options
),
...
...
packages/uni-mp-vite/src/plugins/mainJs.ts
浏览文件 @
81329b2e
import
{
defineUniMainJsPlugin
}
from
'
@dcloudio/uni-cli-shared
'
import
{
UniMiniProgramPluginOptions
}
from
'
../plugin
'
export
function
uniMainJsPlugin
()
{
export
function
uniMainJsPlugin
(
options
:
UniMiniProgramPluginOptions
)
{
return
defineUniMainJsPlugin
((
opts
)
=>
{
return
{
name
:
'
vite:uni-mp-main-js
'
,
...
...
@@ -23,15 +24,9 @@ export function uniMainJsPlugin() {
}
function
createApp
(
code
:
string
)
{
return
`
${
code
.
replace
(
'
createSSRApp
'
,
'
createVueApp as createSSRApp
'
)}
;const __app__=createApp().app;__app__._component.mpType='app';__app__._component.render=()=>{};__app__.use(uni.__vuePlugin).mount("#app");`
return
`
${
code
}
;createApp().app.mount("#app");`
}
function
createLegacyApp
(
code
:
string
)
{
return
`function createApp(rootComponent,rootProps){rootComponent.mpTye='app';const app=createVueApp(rootComponent,rootProps).use(uni.__vuePlugin);app.render=()=>{};const oldMount=app.mount;app.mount=(container)=>{const appVm=oldMount.call(app,container);return appVm;};return app;};
${
code
.
replace
(
'
createApp
'
,
'
createVueApp
'
)}
`
return
code
}
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
81329b2e
...
...
@@ -2561,7 +2561,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
// local registration
// check instance[type] first which is resolved for options API
resolve
(
instance
[
type
]
||
Component
[
type
],
name
)
||
//
window
registration
//
global
registration
resolve
(
instance
.
appContext
[
type
],
name
);
if
(
!
res
&&
maybeSelfReference
)
{
// fallback to implicit self-reference
...
...
@@ -3048,7 +3048,7 @@ const PublicInstanceProxyHandlers = {
return
ctx
[
key
];
}
else
if
(
//
window
properties
//
global
properties
((
globalProperties
=
appContext
.
config
.
globalProperties
),
hasOwn
(
globalProperties
,
key
)))
{
{
...
...
@@ -3392,6 +3392,11 @@ let compile;
const
isRuntimeOnly
=
()
=>
!
compile
;
function
finishComponentSetup
(
instance
,
isSSR
,
skipOptions
)
{
const
Component
=
instance
.
type
;
// template / render function normalization
// could be already set when returned from setup()
if
(
!
instance
.
render
)
{
instance
.
render
=
(
Component
.
render
||
NOOP
);
}
// support for 2.x options
if
(
__VUE_OPTIONS_API__
&&
!
(
false
))
{
setCurrentInstance
(
instance
);
...
...
@@ -4542,61 +4547,25 @@ function getMPInstanceData(instance, keys) {
});
return
ret
;
}
function
getVueInstanceData
(
instance
)
{
const
{
data
,
setupState
,
ctx
}
=
instance
;
const
keys
=
new
Set
();
const
ret
=
Object
.
create
(
null
);
Object
.
keys
(
setupState
).
forEach
(
key
=>
{
keys
.
add
(
key
);
ret
[
key
]
=
setupState
[
key
];
});
if
(
data
)
{
Object
.
keys
(
data
).
forEach
(
key
=>
{
if
(
!
keys
.
has
(
key
))
{
keys
.
add
(
key
);
ret
[
key
]
=
data
[
key
];
}
});
}
if
(
__VUE_OPTIONS_API__
)
{
if
(
ctx
.
$computedKeys
)
{
ctx
.
$computedKeys
.
forEach
((
key
)
=>
{
if
(
!
keys
.
has
(
key
))
{
keys
.
add
(
key
);
ret
[
key
]
=
ctx
[
key
];
}
});
}
}
if
(
ctx
.
$mp
)
{
// TODO
extend
(
ret
,
ctx
.
$mp
.
data
||
{});
}
// TODO form-field
// track
return
{
keys
,
data
:
JSON
.
parse
(
JSON
.
stringify
(
ret
))
};
}
function
patch
(
instance
)
{
function
patch
(
instance
,
data
)
{
const
ctx
=
instance
.
ctx
;
const
mpType
=
ctx
.
mpType
;
if
(
mpType
===
'
page
'
||
mpType
===
'
component
'
)
{
const
start
=
Date
.
now
();
const
mpInstance
=
ctx
.
$scope
;
const
{
keys
,
data
}
=
getVueInstanceData
(
instance
);
const
keys
=
Object
.
keys
(
data
);
// data.__webviewId__ = mpInstance.data.__webviewId__
const
diffData
=
diff
(
data
,
getMPInstanceData
(
mpInstance
,
keys
));
if
(
Object
.
keys
(
diffData
).
length
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
log
(
'
[
'
+
+
new
Date
()
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
instance
.
uid
+
'
][耗时
'
+
(
Date
.
now
()
-
start
)
+
'
]差量更新
'
,
JSON
.
stringify
(
diffData
));
}
console
.
log
(
'
[
'
+
+
new
Date
()
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
instance
.
uid
+
'
][耗时
'
+
(
Date
.
now
()
-
start
)
+
'
]差量更新
'
,
JSON
.
stringify
(
diffData
));
ctx
.
__next_tick_pending
=
true
;
mpInstance
.
setData
(
diffData
,
()
=>
{
ctx
.
__next_tick_pending
=
false
;
...
...
@@ -4670,11 +4639,48 @@ function mountComponent(initialVNode, options) {
}
return
instance
.
proxy
;
}
const
getFunctionalFallthrough
=
(
attrs
)
=>
{
let
res
;
for
(
const
key
in
attrs
)
{
if
(
key
===
'
class
'
||
key
===
'
style
'
||
isOn
(
key
))
{
(
res
||
(
res
=
{}))[
key
]
=
attrs
[
key
];
}
}
return
res
;
};
function
renderComponentRoot
(
instance
)
{
const
{
type
:
Component
,
vnode
,
proxy
,
withProxy
,
props
,
slots
,
attrs
,
emit
,
render
,
renderCache
,
data
,
setupState
,
ctx
}
=
instance
;
let
result
;
const
prev
=
setCurrentRenderingInstance
(
instance
);
try
{
if
(
vnode
.
shapeFlag
&
4
/* STATEFUL_COMPONENT */
)
{
// withProxy is a proxy with a different `has` trap only for
// runtime-compiled render functions using `with` block.
const
proxyToUse
=
withProxy
||
proxy
;
result
=
render
.
call
(
proxyToUse
,
proxyToUse
,
renderCache
,
props
,
setupState
,
data
,
ctx
);
}
else
{
// functional
const
render
=
Component
;
result
=
render
.
length
>
1
?
render
(
props
,
{
attrs
,
slots
,
emit
})
:
render
(
props
,
null
/* we know it doesn't need it */
)
?
attrs
:
getFunctionalFallthrough
(
attrs
);
}
}
catch
(
err
)
{
handleError
(
err
,
instance
,
1
/* RENDER_FUNCTION */
);
result
=
false
;
}
setCurrentRenderingInstance
(
prev
);
return
result
;
}
function
setupRenderEffect
(
instance
)
{
const
componentUpdateFn
=
()
=>
{
if
(
!
instance
.
isMounted
)
{
instance
.
render
&&
instance
.
render
.
call
(
instance
.
proxy
);
patch
(
instance
);
patch
(
instance
,
renderComponentRoot
(
instance
));
}
else
{
instance
.
render
&&
instance
.
render
.
call
(
instance
.
proxy
);
...
...
@@ -4686,7 +4692,7 @@ function setupRenderEffect(instance) {
invokeArrayFns
(
bu
);
}
effect
.
allowRecurse
=
true
;
patch
(
instance
);
patch
(
instance
,
renderComponentRoot
(
instance
)
);
// updated hook
if
(
u
)
{
queuePostRenderEffect$1
(
u
);
...
...
@@ -4928,8 +4934,7 @@ var plugin = {
const
oldMount
=
app
.
mount
;
app
.
mount
=
function
mount
(
rootContainer
)
{
const
instance
=
oldMount
.
call
(
app
,
rootContainer
);
// @ts-ignore
createMiniProgramApp
(
instance
);
global
.
createApp
(
instance
);
return
instance
;
};
},
...
...
packages/uni-mp-vue/lib/vue.runtime.esm.js
浏览文件 @
81329b2e
...
...
@@ -3324,6 +3324,11 @@ let compile;
const
isRuntimeOnly
=
()
=>
!
compile
;
function
finishComponentSetup
(
instance
,
isSSR
,
skipOptions
)
{
const
Component
=
instance
.
type
;
// template / render function normalization
// could be already set when returned from setup()
if
(
!
instance
.
render
)
{
instance
.
render
=
(
Component
.
render
||
NOOP
);
}
// support for 2.x options
if
(
__VUE_OPTIONS_API__
&&
!
(
false
))
{
setCurrentInstance
(
instance
);
...
...
@@ -4474,61 +4479,25 @@ function getMPInstanceData(instance, keys) {
});
return
ret
;
}
function
getVueInstanceData
(
instance
)
{
const
{
data
,
setupState
,
ctx
}
=
instance
;
const
keys
=
new
Set
();
const
ret
=
Object
.
create
(
null
);
Object
.
keys
(
setupState
).
forEach
(
key
=>
{
keys
.
add
(
key
);
ret
[
key
]
=
setupState
[
key
];
});
if
(
data
)
{
Object
.
keys
(
data
).
forEach
(
key
=>
{
if
(
!
keys
.
has
(
key
))
{
keys
.
add
(
key
);
ret
[
key
]
=
data
[
key
];
}
});
}
if
(
__VUE_OPTIONS_API__
)
{
if
(
ctx
.
$computedKeys
)
{
ctx
.
$computedKeys
.
forEach
((
key
)
=>
{
if
(
!
keys
.
has
(
key
))
{
keys
.
add
(
key
);
ret
[
key
]
=
ctx
[
key
];
}
});
}
}
if
(
ctx
.
$mp
)
{
// TODO
extend
(
ret
,
ctx
.
$mp
.
data
||
{});
}
// TODO form-field
// track
return
{
keys
,
data
:
JSON
.
parse
(
JSON
.
stringify
(
ret
))
};
}
function
patch
(
instance
)
{
function
patch
(
instance
,
data
)
{
const
ctx
=
instance
.
ctx
;
const
mpType
=
ctx
.
mpType
;
if
(
mpType
===
'
page
'
||
mpType
===
'
component
'
)
{
const
start
=
Date
.
now
();
const
mpInstance
=
ctx
.
$scope
;
const
{
keys
,
data
}
=
getVueInstanceData
(
instance
);
const
keys
=
Object
.
keys
(
data
);
// data.__webviewId__ = mpInstance.data.__webviewId__
const
diffData
=
diff
(
data
,
getMPInstanceData
(
mpInstance
,
keys
));
if
(
Object
.
keys
(
diffData
).
length
)
{
if
(
process
.
env
.
VUE_APP_DEBUG
)
{
console
.
log
(
'
[
'
+
+
new
Date
()
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
instance
.
uid
+
'
][耗时
'
+
(
Date
.
now
()
-
start
)
+
'
]差量更新
'
,
JSON
.
stringify
(
diffData
));
}
console
.
log
(
'
[
'
+
+
new
Date
()
+
'
][
'
+
(
mpInstance
.
is
||
mpInstance
.
route
)
+
'
][
'
+
instance
.
uid
+
'
][耗时
'
+
(
Date
.
now
()
-
start
)
+
'
]差量更新
'
,
JSON
.
stringify
(
diffData
));
ctx
.
__next_tick_pending
=
true
;
mpInstance
.
setData
(
diffData
,
()
=>
{
ctx
.
__next_tick_pending
=
false
;
...
...
@@ -4602,11 +4571,48 @@ function mountComponent(initialVNode, options) {
}
return
instance
.
proxy
;
}
const
getFunctionalFallthrough
=
(
attrs
)
=>
{
let
res
;
for
(
const
key
in
attrs
)
{
if
(
key
===
'
class
'
||
key
===
'
style
'
||
isOn
(
key
))
{
(
res
||
(
res
=
{}))[
key
]
=
attrs
[
key
];
}
}
return
res
;
};
function
renderComponentRoot
(
instance
)
{
const
{
type
:
Component
,
vnode
,
proxy
,
withProxy
,
props
,
slots
,
attrs
,
emit
,
render
,
renderCache
,
data
,
setupState
,
ctx
}
=
instance
;
let
result
;
const
prev
=
setCurrentRenderingInstance
(
instance
);
try
{
if
(
vnode
.
shapeFlag
&
4
/* STATEFUL_COMPONENT */
)
{
// withProxy is a proxy with a different `has` trap only for
// runtime-compiled render functions using `with` block.
const
proxyToUse
=
withProxy
||
proxy
;
result
=
render
.
call
(
proxyToUse
,
proxyToUse
,
renderCache
,
props
,
setupState
,
data
,
ctx
);
}
else
{
// functional
const
render
=
Component
;
result
=
render
.
length
>
1
?
render
(
props
,
{
attrs
,
slots
,
emit
})
:
render
(
props
,
null
/* we know it doesn't need it */
)
?
attrs
:
getFunctionalFallthrough
(
attrs
);
}
}
catch
(
err
)
{
handleError
(
err
,
instance
,
1
/* RENDER_FUNCTION */
);
result
=
false
;
}
setCurrentRenderingInstance
(
prev
);
return
result
;
}
function
setupRenderEffect
(
instance
)
{
const
componentUpdateFn
=
()
=>
{
if
(
!
instance
.
isMounted
)
{
instance
.
render
&&
instance
.
render
.
call
(
instance
.
proxy
);
patch
(
instance
);
patch
(
instance
,
renderComponentRoot
(
instance
));
}
else
{
instance
.
render
&&
instance
.
render
.
call
(
instance
.
proxy
);
...
...
@@ -4618,7 +4624,7 @@ function setupRenderEffect(instance) {
invokeArrayFns
(
bu
);
}
effect
.
allowRecurse
=
true
;
patch
(
instance
);
patch
(
instance
,
renderComponentRoot
(
instance
)
);
// updated hook
if
(
u
)
{
queuePostRenderEffect$1
(
u
);
...
...
packages/uni-mp-vue/src/plugin.ts
浏览文件 @
81329b2e
...
...
@@ -8,8 +8,7 @@ export default {
const
oldMount
=
app
.
mount
app
.
mount
=
function
mount
(
rootContainer
:
any
)
{
const
instance
=
oldMount
.
call
(
app
,
rootContainer
)
// @ts-ignore
createMiniProgramApp
(
instance
)
;(
global
as
any
).
createApp
(
instance
)
return
instance
}
},
...
...
packages/uni-mp-weixin/build.json
浏览文件 @
81329b2e
...
...
@@ -26,7 +26,6 @@
]
},
"replacements"
:
{
"global"
:
"global"
,
"__GLOBAL__"
:
"wx"
,
"__PLATFORM__"
:
"
\"
mp-weixin
\"
"
,
"__PLATFORM_TITLE__"
:
"微信小程序"
...
...
packages/uni-mp-weixin/dist/uni.compiler.js
浏览文件 @
81329b2e
...
...
@@ -7,11 +7,24 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
var
initMiniProgramPlugin__default
=
/*#__PURE__*/
_interopDefaultLegacy
(
initMiniProgramPlugin
);
var
index
=
initMiniProgramPlugin__default
[
"
default
"
]({
global
:
'
wx
'
,
alias
:
{
'
uni-mp-runtime
'
:
uniCliShared
.
resolveBuiltIn
(
'
@dcloudio/uni-mp-weixin/dist/uni.mp.esm.js
'
),
const
uniMiniProgramWeixinPlugin
=
{
name
:
'
vite:uni-mp-weixin
'
,
config
()
{
return
{
define
:
{
__VUE_CREATED_DEFERRED__
:
JSON
.
stringify
(
'
false
'
),
},
};
},
});
};
var
index
=
[
uniMiniProgramWeixinPlugin
,
...
initMiniProgramPlugin__default
[
"
default
"
]({
global
:
'
wx
'
,
alias
:
{
'
uni-mp-runtime
'
:
uniCliShared
.
resolveBuiltIn
(
'
@dcloudio/uni-mp-weixin/dist/uni.mp.esm.js
'
),
},
}),
];
module
.
exports
=
index
;
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
81329b2e
...
...
@@ -1178,7 +1178,7 @@ var parseOptions = /*#__PURE__*/Object.freeze({
const
createApp
=
initCreateApp
();
const
createPage
=
initCreatePage
(
parseOptions
);
const
createComponent
=
initCreateComponent
(
parseOptions
);
wx
.
createApp
=
createApp
;
wx
.
createApp
=
global
.
createApp
=
createApp
;
wx
.
createPage
=
createPage
;
wx
.
createComponent
=
createComponent
;
...
...
packages/uni-mp-weixin/src/plugin/index.ts
浏览文件 @
81329b2e
import
{
Plugin
}
from
'
vite
'
import
{
resolveBuiltIn
}
from
'
@dcloudio/uni-cli-shared
'
import
initMiniProgramPlugin
from
'
@dcloudio/uni-mp-vite
'
export
default
initMiniProgramPlugin
({
global
:
'
wx
'
,
alias
:
{
'
uni-mp-runtime
'
:
resolveBuiltIn
(
'
@dcloudio/uni-mp-weixin/dist/uni.mp.esm.js
'
),
const
uniMiniProgramWeixinPlugin
:
Plugin
=
{
name
:
'
vite:uni-mp-weixin
'
,
config
()
{
return
{
define
:
{
__VUE_CREATED_DEFERRED__
:
JSON
.
stringify
(
'
false
'
),
},
}
},
})
}
export
default
[
uniMiniProgramWeixinPlugin
,
...
initMiniProgramPlugin
({
global
:
'
wx
'
,
alias
:
{
'
uni-mp-runtime
'
:
resolveBuiltIn
(
'
@dcloudio/uni-mp-weixin/dist/uni.mp.esm.js
'
),
},
}),
]
packages/uni-mp-weixin/src/runtime/index.ts
浏览文件 @
81329b2e
...
...
@@ -11,6 +11,6 @@ import * as parseOptions from './parseOptions'
export
const
createApp
=
initCreateApp
()
export
const
createPage
=
initCreatePage
(
parseOptions
)
export
const
createComponent
=
initCreateComponent
(
parseOptions
)
;(
wx
as
any
).
createApp
=
createApp
;(
wx
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
wx
as
any
).
createPage
=
createPage
;(
wx
as
any
).
createComponent
=
createComponent
packages/uni-quickapp-webview/build.json
浏览文件 @
81329b2e
...
...
@@ -16,7 +16,6 @@
]
},
"replacements"
:
{
"global"
:
"global"
,
"__GLOBAL__"
:
"qa"
,
"__PLATFORM__"
:
"
\"
quickapp-webview
\"
"
,
"__PLATFORM_TITLE__"
:
"快应用(Webview)版"
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
81329b2e
...
...
@@ -1328,7 +1328,7 @@ const createApp = initCreateApp();
const
createPage
=
initCreatePage
(
parsePageOptions
);
const
createComponent
=
initCreateComponent
(
parseComponentOptions
);
qa
.
EventChannel
=
EventChannel
;
qa
.
createApp
=
createApp
;
qa
.
createApp
=
global
.
createApp
=
createApp
;
qa
.
createPage
=
createPage
;
qa
.
createComponent
=
createComponent
;
...
...
packages/uni-quickapp-webview/src/runtime/index.ts
浏览文件 @
81329b2e
...
...
@@ -14,6 +14,6 @@ export const createApp = initCreateApp()
export
const
createPage
=
initCreatePage
(
parsePageOptions
)
export
const
createComponent
=
initCreateComponent
(
parseComponentOptions
)
;(
qa
as
any
).
EventChannel
=
EventChannel
;(
qa
as
any
).
createApp
=
createApp
;(
qa
as
any
).
createApp
=
(
global
as
any
).
createApp
=
createApp
;(
qa
as
any
).
createPage
=
createPage
;(
qa
as
any
).
createComponent
=
createComponent
rollup.config.js
浏览文件 @
81329b2e
...
...
@@ -184,11 +184,13 @@ function createAliasPlugin(buildOption) {
function
createReplacePlugin
(
buildOption
,
format
)
{
const
replacements
=
{
global
:
format
===
'
cjs
'
?
'
global
'
:
'
window
'
,
__DEV__
:
`(process.env.NODE_ENV !== 'production')`
,
__TEST__
:
false
,
__NODE_JS__
:
format
===
'
cjs
'
,
}
// if (process.env.TARGET === 'uni-h5') {
// replacements.global = format === 'cjs' ? 'global' : 'window'
// }
if
(
buildOption
.
replacements
)
{
Object
.
assign
(
replacements
,
buildOption
.
replacements
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录