Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
ca3c8ada
U
uni-app
项目概览
MuGuiLin
/
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,发现更多精彩内容 >>
提交
ca3c8ada
编写于
1月 12, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp): defineExpose (#3180)
上级
b88df708
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
65 addition
and
133 deletion
+65
-133
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+1
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+1
-0
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+4
-12
packages/uni-mp-alipay/src/runtime/util.ts
packages/uni-mp-alipay/src/runtime/util.ts
+1
-2
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+5
-13
packages/uni-mp-core/src/index.ts
packages/uni-mp-core/src/index.ts
+0
-1
packages/uni-mp-core/src/runtime/component.ts
packages/uni-mp-core/src/runtime/component.ts
+7
-1
packages/uni-mp-core/src/runtime/componentInstance.ts
packages/uni-mp-core/src/runtime/componentInstance.ts
+0
-3
packages/uni-mp-core/src/runtime/util.ts
packages/uni-mp-core/src/runtime/util.ts
+4
-12
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+5
-13
packages/uni-mp-lark/dist/uni.mp.esm.js
packages/uni-mp-lark/dist/uni.mp.esm.js
+5
-13
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+5
-13
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+5
-13
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+6
-4
packages/uni-mp-vue/lib/vue.runtime.esm.js
packages/uni-mp-vue/lib/vue.runtime.esm.js
+6
-4
packages/uni-mp-vue/src/helpers/ref.ts
packages/uni-mp-vue/src/helpers/ref.ts
+0
-2
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+5
-13
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+5
-13
未找到文件。
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
ca3c8ada
此差异已折叠。
点击以展开。
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
ca3c8ada
...
...
@@ -9636,6 +9636,7 @@ function useMovableViewState(props2, trigger, rootRef) {
}
}
function __handleTouchMove(event) {
event.stopPropagation();
if (!_isScaling && !props2.disabled && _isTouching) {
let x = _translateX;
let y = _translateY;
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
hasOwn
,
isArray
,
capitalize
,
isFunction
,
extend
,
isString
,
camelize
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
EMPTY_OBJ
,
isRef
,
setTemplateRef
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
EMPTY_OBJ
,
isRef
,
setTemplateRef
,
pruneComponentPropsCache
}
from
'
vue
'
;
// quickapp-webview 不能使用 default 作为插槽名称
const
SLOT_DEFAULT_NAME
=
'
d
'
;
...
...
@@ -175,8 +175,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -434,13 +432,6 @@ function initWxsCallMethods(methods, wxsCallMethods) {
};
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
findVmByVueId
(
instance
,
vuePid
)
{
// 标准 vue3 中 没有 $children,定制了内核
const
$children
=
instance
.
$children
;
...
...
@@ -610,7 +601,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
@@ -766,7 +758,7 @@ function handleRef(ref) {
const
instance
=
this
.
$vm
.
$
;
const
refs
=
instance
.
refs
===
EMPTY_OBJ
?
(
instance
.
refs
=
{})
:
instance
.
refs
;
const
{
setupState
}
=
instance
;
const
refValue
=
findRefValue
(
ref
)
;
const
refValue
=
ref
.
$vm
;
if
(
refName
)
{
if
(
isString
(
refName
))
{
refs
[
refName
]
=
refValue
;
...
...
packages/uni-mp-alipay/src/runtime/util.ts
浏览文件 @
ca3c8ada
...
...
@@ -17,7 +17,6 @@ import {
initComponentInstance
,
CreateComponentOptions
,
updateComponentProps
,
findRefValue
,
findPropsData
,
}
from
'
@dcloudio/uni-mp-core
'
...
...
@@ -145,7 +144,7 @@ export function handleRef(this: MPComponentInstance, ref: MPComponentInstance) {
instance
.
refs
===
EMPTY_OBJ
?
(
instance
.
refs
=
{})
:
instance
.
refs
const
{
setupState
}
=
instance
const
refValue
=
findRefValue
(
ref
as
any
)
const
refValue
=
ref
.
$vm
if
(
refName
)
{
if
(
isString
(
refName
))
{
refs
[
refName
]
=
refValue
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
,
camelize
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
nextTick
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
// lifecycle
// App and Page
...
...
@@ -241,8 +241,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -509,16 +507,9 @@ function selectAllComponents(mpInstance, selector, $refs) {
const
components
=
mpInstance
.
selectAllComponents
(
selector
);
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
;
$refs
[
ref
]
=
findRefValue
(
component
)
;
$refs
[
ref
]
=
component
.
$vm
||
component
;
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
initRefs
(
instance
,
mpInstance
)
{
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
...
...
@@ -533,7 +524,7 @@ function initRefs(instance, mpInstance) {
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[];
}
$refs
[
ref
].
push
(
findRefValue
(
component
)
);
$refs
[
ref
].
push
(
component
.
$vm
||
component
);
});
return
$refs
;
},
...
...
@@ -881,7 +872,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
packages/uni-mp-core/src/index.ts
浏览文件 @
ca3c8ada
...
...
@@ -40,7 +40,6 @@ export {
fixProperties
,
nextSetDataTick
,
initSetRef
,
findRefValue
,
}
from
'
./runtime/util
'
// protocols
...
...
packages/uni-mp-core/src/runtime/component.ts
浏览文件 @
ca3c8ada
import
{
extend
}
from
'
@vue/shared
'
import
{
ComponentOptions
,
ComponentPublicInstance
}
from
'
vue
'
// @ts-expect-error
import
{
getExposeProxy
}
from
'
vue
'
import
{
initExtraOptions
,
initWxsCallMethods
,
initBehavior
}
from
'
./util
'
...
...
@@ -149,7 +151,11 @@ export function $createComponent(
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
}
return
$createComponentFn
(
initialVNode
,
options
)
const
proxy
=
$createComponentFn
(
initialVNode
,
options
)
as
ComponentPublicInstance
return
getExposeProxy
(
proxy
.
$
)
||
proxy
}
export
function
$destroyComponent
(
instance
:
ComponentPublicInstance
)
{
...
...
packages/uni-mp-core/src/runtime/componentInstance.ts
浏览文件 @
ca3c8ada
...
...
@@ -70,9 +70,6 @@ export function initBaseInstance(
ctx
.
_self
=
{}
}
// $vm
ctx
.
$scope
.
$vm
=
(
instance
as
any
).
proxy
!
// slots
instance
.
slots
=
{}
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
packages/uni-mp-core/src/runtime/util.ts
浏览文件 @
ca3c8ada
...
...
@@ -4,9 +4,9 @@ import {
ComponentInternalInstance
,
ComponentPublicInstance
,
nextTick
,
markRaw
,
proxyRefs
,
}
from
'
vue
'
// @ts-ignore
import
{
getExposeProxy
}
from
'
vue
'
import
{
MPComponentInstance
,
MPComponentOptions
}
from
'
./component
'
...
...
@@ -67,18 +67,10 @@ function selectAllComponents(
const
components
=
mpInstance
.
selectAllComponents
(
selector
)
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
$refs
[
ref
]
=
findRefValue
(
component
as
MPComponentInstance
)
$refs
[
ref
]
=
component
.
$vm
||
component
})
}
export
function
findRefValue
(
component
:
MPComponentInstance
)
{
const
vm
=
component
.
$vm
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
}
return
component
}
export
function
initRefs
(
instance
:
ComponentInternalInstance
,
mpInstance
:
MPComponentInstance
...
...
@@ -96,7 +88,7 @@ export function initRefs(
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[]
}
$refs
[
ref
].
push
(
findRefValue
(
component
as
MPComponentInstance
)
)
$refs
[
ref
].
push
(
component
.
$vm
||
component
)
})
return
$refs
},
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
,
camelize
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
nextTick
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
const
ON_READY$1
=
'
onReady
'
;
...
...
@@ -236,8 +236,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -504,16 +502,9 @@ function selectAllComponents(mpInstance, selector, $refs) {
const
components
=
mpInstance
.
selectAllComponents
(
selector
);
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
;
$refs
[
ref
]
=
findRefValue
(
component
)
;
$refs
[
ref
]
=
component
.
$vm
||
component
;
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
initRefs
(
instance
,
mpInstance
)
{
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
...
...
@@ -528,7 +519,7 @@ function initRefs(instance, mpInstance) {
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[];
}
$refs
[
ref
].
push
(
findRefValue
(
component
)
);
$refs
[
ref
].
push
(
component
.
$vm
||
component
);
});
return
$refs
;
},
...
...
@@ -865,7 +856,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
packages/uni-mp-lark/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
,
camelize
,
isObject
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
nextTick
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
const
ON_READY$1
=
'
onReady
'
;
...
...
@@ -232,8 +232,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -503,16 +501,9 @@ function selectAllComponents(mpInstance, selector, $refs) {
const
components
=
mpInstance
.
selectAllComponents
(
selector
);
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
;
$refs
[
ref
]
=
findRefValue
(
component
)
;
$refs
[
ref
]
=
component
.
$vm
||
component
;
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
initRefs
(
instance
,
mpInstance
)
{
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
...
...
@@ -527,7 +518,7 @@ function initRefs(instance, mpInstance) {
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[];
}
$refs
[
ref
].
push
(
findRefValue
(
component
)
);
$refs
[
ref
].
push
(
component
.
$vm
||
component
);
});
return
$refs
;
},
...
...
@@ -838,7 +829,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
,
camelize
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
const
ON_READY$1
=
'
onReady
'
;
...
...
@@ -232,8 +232,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -500,16 +498,9 @@ function selectAllComponents(mpInstance, selector, $refs) {
const
components
=
mpInstance
.
selectAllComponents
(
selector
);
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
;
$refs
[
ref
]
=
findRefValue
(
component
)
;
$refs
[
ref
]
=
component
.
$vm
||
component
;
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
initRefs
(
instance
,
mpInstance
)
{
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
...
...
@@ -524,7 +515,7 @@ function initRefs(instance, mpInstance) {
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[];
}
$refs
[
ref
].
push
(
findRefValue
(
component
)
);
$refs
[
ref
].
push
(
component
.
$vm
||
component
);
});
return
$refs
;
},
...
...
@@ -827,7 +818,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
,
camelize
,
isObject
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
nextTick
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
const
ON_READY$1
=
'
onReady
'
;
...
...
@@ -232,8 +232,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -503,16 +501,9 @@ function selectAllComponents(mpInstance, selector, $refs) {
const
components
=
mpInstance
.
selectAllComponents
(
selector
);
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
;
$refs
[
ref
]
=
findRefValue
(
component
)
;
$refs
[
ref
]
=
component
.
$vm
||
component
;
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
initRefs
(
instance
,
mpInstance
)
{
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
...
...
@@ -527,7 +518,7 @@ function initRefs(instance, mpInstance) {
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[];
}
$refs
[
ref
].
push
(
findRefValue
(
component
)
);
$refs
[
ref
].
push
(
component
.
$vm
||
component
);
});
return
$refs
;
},
...
...
@@ -838,7 +829,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
ca3c8ada
...
...
@@ -3520,9 +3520,11 @@ function getExposeProxy(instance) {
if
(
key
in
target
)
{
return
target
[
key
];
}
else
if
(
key
in
publicPropertiesMap
)
{
return
publicPropertiesMap
[
key
](
instance
);
}
// fixed by xxxxxx 框架内部需要访问很多非 public 属性,暂不做限制
return
instance
.
proxy
[
key
];
// else if (key in publicPropertiesMap) {
// return publicPropertiesMap[key](instance)
// }
}
})));
}
...
...
@@ -4812,7 +4814,7 @@ function mountComponent(initialVNode, options) {
if
(
__VUE_OPTIONS_API__
)
{
// $children
if
(
options
.
parentComponent
&&
instance
.
proxy
)
{
options
.
parentComponent
.
ctx
.
$children
.
push
(
instance
.
proxy
);
options
.
parentComponent
.
ctx
.
$children
.
push
(
getExposeProxy
(
instance
)
||
instance
.
proxy
);
}
}
setupRenderEffect
(
instance
);
...
...
packages/uni-mp-vue/lib/vue.runtime.esm.js
浏览文件 @
ca3c8ada
...
...
@@ -3520,9 +3520,11 @@ function getExposeProxy(instance) {
if
(
key
in
target
)
{
return
target
[
key
];
}
else
if
(
key
in
publicPropertiesMap
)
{
return
publicPropertiesMap
[
key
](
instance
);
}
// fixed by xxxxxx 框架内部需要访问很多非 public 属性,暂不做限制
return
instance
.
proxy
[
key
];
// else if (key in publicPropertiesMap) {
// return publicPropertiesMap[key](instance)
// }
}
})));
}
...
...
@@ -4812,7 +4814,7 @@ function mountComponent(initialVNode, options) {
if
(
__VUE_OPTIONS_API__
)
{
// $children
if
(
options
.
parentComponent
&&
instance
.
proxy
)
{
options
.
parentComponent
.
ctx
.
$children
.
push
(
instance
.
proxy
);
options
.
parentComponent
.
ctx
.
$children
.
push
(
getExposeProxy
(
instance
)
||
instance
.
proxy
);
}
}
setupRenderEffect
(
instance
);
...
...
packages/uni-mp-vue/src/helpers/ref.ts
浏览文件 @
ca3c8ada
import
{
ComponentInternalInstance
,
getCurrentInstance
,
Ref
}
from
'
vue
'
// @ts-ignore
import
{
getExposeProxy
}
from
'
vue
'
type
VNodeRef
=
|
string
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
,
camelize
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
// quickapp-webview 不能使用 default 作为插槽名称
const
SLOT_DEFAULT_NAME
=
'
d
'
;
...
...
@@ -104,8 +104,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -372,16 +370,9 @@ function selectAllComponents(mpInstance, selector, $refs) {
const
components
=
mpInstance
.
selectAllComponents
(
selector
);
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
;
$refs
[
ref
]
=
findRefValue
(
component
)
;
$refs
[
ref
]
=
component
.
$vm
||
component
;
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
initRefs
(
instance
,
mpInstance
)
{
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
...
...
@@ -396,7 +387,7 @@ function initRefs(instance, mpInstance) {
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[];
}
$refs
[
ref
].
push
(
findRefValue
(
component
)
);
$refs
[
ref
].
push
(
component
.
$vm
||
component
);
});
return
$refs
;
},
...
...
@@ -699,7 +690,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
ca3c8ada
import
{
isPlainObject
,
isArray
,
hasOwn
,
isFunction
,
extend
,
camelize
,
isObject
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
nextTick
,
getExposeProxy
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
nextTick
,
findComponentPropsData
,
toRaw
,
updateProps
,
invalidateJob
,
getExposeProxy
,
pruneComponentPropsCache
}
from
'
vue
'
;
const
ON_READY$1
=
'
onReady
'
;
...
...
@@ -232,8 +232,6 @@ function initBaseInstance(instance, options) {
if
(
__VUE_OPTIONS_API__
)
{
ctx
.
_self
=
{};
}
// $vm
ctx
.
$scope
.
$vm
=
instance
.
proxy
;
// slots
instance
.
slots
=
{};
if
(
isArray
(
options
.
slots
)
&&
options
.
slots
.
length
)
{
...
...
@@ -500,16 +498,9 @@ function selectAllComponents(mpInstance, selector, $refs) {
const
components
=
mpInstance
.
selectAllComponents
(
selector
);
components
.
forEach
((
component
)
=>
{
const
ref
=
component
.
properties
.
uR
;
$refs
[
ref
]
=
findRefValue
(
component
)
;
$refs
[
ref
]
=
component
.
$vm
||
component
;
});
}
function
findRefValue
(
component
)
{
const
vm
=
component
.
$vm
;
if
(
vm
)
{
return
getExposeProxy
(
vm
.
$
)
||
vm
;
}
return
component
;
}
function
initRefs
(
instance
,
mpInstance
)
{
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
...
...
@@ -524,7 +515,7 @@ function initRefs(instance, mpInstance) {
if
(
!
$refs
[
ref
])
{
$refs
[
ref
]
=
[];
}
$refs
[
ref
].
push
(
findRefValue
(
component
)
);
$refs
[
ref
].
push
(
component
.
$vm
||
component
);
});
return
$refs
;
},
...
...
@@ -816,7 +807,8 @@ function $createComponent(initialVNode, options) {
if
(
!
$createComponentFn
)
{
$createComponentFn
=
getApp
().
$vm
.
$createComponent
;
}
return
$createComponentFn
(
initialVNode
,
options
);
const
proxy
=
$createComponentFn
(
initialVNode
,
options
);
return
getExposeProxy
(
proxy
.
$
)
||
proxy
;
}
function
$destroyComponent
(
instance
)
{
if
(
!
$destroyComponentFn
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录