Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
531e2e39
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
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,发现更多精彩内容 >>
提交
531e2e39
编写于
12月 14, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mp): support ref in v-for
上级
789d9718
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
376 addition
and
190 deletion
+376
-190
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+2
-2
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+2
-2
packages/uni-mp-alipay/__tests__/ref.spec.ts
packages/uni-mp-alipay/__tests__/ref.spec.ts
+31
-3
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+16
-8
packages/uni-mp-alipay/src/runtime/util.ts
packages/uni-mp-alipay/src/runtime/util.ts
+38
-11
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+1
-0
packages/uni-mp-compiler/__tests__/ref.spec.ts
packages/uni-mp-compiler/__tests__/ref.spec.ts
+8
-8
packages/uni-mp-compiler/src/transforms/transformRef.ts
packages/uni-mp-compiler/src/transforms/transformRef.ts
+69
-74
packages/uni-mp-core/src/runtime/componentInstance.ts
packages/uni-mp-core/src/runtime/componentInstance.ts
+1
-0
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+1
-0
packages/uni-mp-lark/dist/uni.mp.esm.js
packages/uni-mp-lark/dist/uni.mp.esm.js
+1
-0
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+1
-0
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+1
-0
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+91
-37
packages/uni-mp-vue/lib/vue.runtime.esm.js
packages/uni-mp-vue/lib/vue.runtime.esm.js
+87
-2
packages/uni-mp-vue/src/helpers/index.ts
packages/uni-mp-vue/src/helpers/index.ts
+1
-1
packages/uni-mp-vue/src/helpers/ref.ts
packages/uni-mp-vue/src/helpers/ref.ts
+23
-42
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+1
-0
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+1
-0
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
531e2e39
...
@@ -16025,7 +16025,7 @@ var serviceContext = (function (vue) {
...
@@ -16025,7 +16025,7 @@ var serviceContext = (function (vue) {
errMsg: 'getLocation:ok',
errMsg: 'getLocation:ok',
});
});
}
}
const getLocation = defineAsyncApi(API_GET_LOCATION, ({ type = 'wgs84', geocode = false, altitude = false, highAccuracyExpireTime, }, { resolve, reject }) => {
const getLocation = defineAsyncApi(API_GET_LOCATION, ({ type = 'wgs84', geocode = false, altitude = false, highAccuracyExpireTime,
isHighAccuracy = false,
}, { resolve, reject }) => {
plus.geolocation.getCurrentPosition((position) => {
plus.geolocation.getCurrentPosition((position) => {
getLocationSuccess(type, position, resolve);
getLocationSuccess(type, position, resolve);
}, (e) => {
}, (e) => {
...
@@ -16037,7 +16037,7 @@ var serviceContext = (function (vue) {
...
@@ -16037,7 +16037,7 @@ var serviceContext = (function (vue) {
reject('getLocation:fail ' + e.message);
reject('getLocation:fail ' + e.message);
}, {
}, {
geocode: geocode,
geocode: geocode,
enableHighAccuracy: altitude,
enableHighAccuracy:
isHighAccuracy ||
altitude,
timeout: highAccuracyExpireTime,
timeout: highAccuracyExpireTime,
});
});
}, GetLocationProtocol, GetLocationOptions);
}, GetLocationProtocol, GetLocationOptions);
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
531e2e39
...
@@ -17655,12 +17655,12 @@ function getJSONP(url, options, success, error) {
...
@@ -17655,12 +17655,12 @@ function getJSONP(url, options, success, error) {
js.src = url + (url.indexOf("?") >= 0 ? "&" : "?") + callbackKey + "=" + callbackName;
js.src = url + (url.indexOf("?") >= 0 ? "&" : "?") + callbackKey + "=" + callbackName;
document.body.appendChild(js);
document.body.appendChild(js);
}
}
const getLocation = /* @__PURE__ */ defineAsyncApi(API_GET_LOCATION, ({ type, altitude, highAccuracyExpireTime }, { resolve, reject }) => {
const getLocation = /* @__PURE__ */ defineAsyncApi(API_GET_LOCATION, ({ type, altitude, highAccuracyExpireTime
, isHighAccuracy
}, { resolve, reject }) => {
const mapInfo = getMapInfo();
const mapInfo = getMapInfo();
new Promise((resolve2, reject2) => {
new Promise((resolve2, reject2) => {
if (navigator.geolocation) {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((res) => resolve2(res.coords), reject2, {
navigator.geolocation.getCurrentPosition((res) => resolve2(res.coords), reject2, {
enableHighAccuracy: altitude,
enableHighAccuracy:
isHighAccuracy ||
altitude,
timeout: highAccuracyExpireTime || 1e3 * 100
timeout: highAccuracyExpireTime || 1e3 * 100
});
});
} else {
} else {
...
...
packages/uni-mp-alipay/__tests__/ref.spec.ts
浏览文件 @
531e2e39
...
@@ -54,14 +54,14 @@ export function render(_ctx, _cache) {
...
@@ -54,14 +54,14 @@ export function render(_ctx, _cache) {
`<custom ref="custom"/>`
,
`<custom ref="custom"/>`
,
`<custom ref="__r" u-r="{{a}}" u-i="2a9ec0b0-0" onVI="__l"/>`
,
`<custom ref="__r" u-r="{{a}}" u-i="2a9ec0b0-0" onVI="__l"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: (
_value, _refs) => { _refs['custom'] = _value; }
}
return { a: (
) => ({ r: custom })
}
}`
}`
)
)
assert
(
assert
(
`<custom v-for="item in items" ref="custom"/>`
,
`<custom v-for="item in items" ref="custom"/>`
,
`<custom a:for="{{a}}" a:for-item="item" ref="__r" u-r-i-f="{{b}}" u-i="{{item.a}}" onVI="__l"/>`
,
`<custom a:for="{{a}}" a:for-item="item" ref="__r" u-r-i-f="{{b}}" u-i="{{item.a}}" onVI="__l"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }), b: (
_value, _refs) => { _refs['custom'] = _value; }
}
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }), b: (
) => ({ r: custom, f: 1 })
}
}`
}`
)
)
})
})
...
@@ -70,7 +70,7 @@ export function render(_ctx, _cache) {
...
@@ -70,7 +70,7 @@ export function render(_ctx, _cache) {
`<custom ref="custom"/>`
,
`<custom ref="custom"/>`
,
`<custom ref="__r" u-r="{{a}}" u-i="2a9ec0b0-0" onVI="__l"/>`
,
`<custom ref="__r" u-r="{{a}}" u-i="2a9ec0b0-0" onVI="__l"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: (
_value, _refs) => { _refs['custom'] = _value; custom.value = _value; }
}
return { a: (
) => ({ r: custom, k: 'custom' })
}
}`
,
}`
,
{
{
bindingMetadata
:
{
bindingMetadata
:
{
...
@@ -79,6 +79,34 @@ export function render(_ctx, _cache) {
...
@@ -79,6 +79,34 @@ export function render(_ctx, _cache) {
}
}
)
)
})
})
test
(
'
static ref with inline and setup-maybe-ref
'
,
()
=>
{
assert
(
`<custom ref="custom"/>`
,
`<custom ref="__r" u-r="{{a}}" u-i="2a9ec0b0-0" onVI="__l"/>`
,
`(_ctx, _cache) => {
return { a: () => ({ r: custom, k: 'custom' }) }
}`
,
{
bindingMetadata
:
{
custom
:
BindingTypes
.
SETUP_MAYBE_REF
,
},
}
)
})
test
(
'
static ref with inline and setup-let
'
,
()
=>
{
assert
(
`<custom ref="custom"/>`
,
`<custom ref="__r" u-r="{{a}}" u-i="2a9ec0b0-0" onVI="__l"/>`
,
`(_ctx, _cache) => {
return { a: () => ({ r: custom, k: 'custom' }) }
}`
,
{
bindingMetadata
:
{
custom
:
BindingTypes
.
SETUP_LET
,
},
}
)
})
test
(
'
dynamic ref
'
,
()
=>
{
test
(
'
dynamic ref
'
,
()
=>
{
assert
(
assert
(
`<custom :ref="custom"/>`
,
`<custom :ref="custom"/>`
,
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
531e2e39
import
{
isPlainObject
,
hasOwn
,
isArray
,
capitalize
,
isFunction
,
extend
,
EMPTY_OBJ
,
isString
,
camelize
}
from
'
@vue/shared
'
;
import
{
isPlainObject
,
hasOwn
,
isArray
,
capitalize
,
isFunction
,
extend
,
isString
,
camelize
}
from
'
@vue/shared
'
;
import
{
injectHook
,
ref
,
toRaw
,
findComponentPropsData
,
updateProps
,
invalidateJob
,
is
Ref
,
pruneComponentPropsCache
}
from
'
vue
'
;
import
{
injectHook
,
ref
,
toRaw
,
findComponentPropsData
,
updateProps
,
invalidateJob
,
EMPTY_OBJ
,
isRef
,
setTemplate
Ref
,
pruneComponentPropsCache
}
from
'
vue
'
;
// quickapp-webview 不能使用 default 作为插槽名称
// quickapp-webview 不能使用 default 作为插槽名称
const
SLOT_DEFAULT_NAME
=
'
d
'
;
const
SLOT_DEFAULT_NAME
=
'
d
'
;
...
@@ -162,6 +162,7 @@ function initBaseInstance(instance, options) {
...
@@ -162,6 +162,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
mp-alipay
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
@@ -721,16 +722,17 @@ function handleRef(ref) {
...
@@ -721,16 +722,17 @@ function handleRef(ref) {
}
}
const
instance
=
this
.
$vm
.
$
;
const
instance
=
this
.
$vm
.
$
;
const
refs
=
instance
.
refs
===
EMPTY_OBJ
?
(
instance
.
refs
=
{})
:
instance
.
refs
;
const
refs
=
instance
.
refs
===
EMPTY_OBJ
?
(
instance
.
refs
=
{})
:
instance
.
refs
;
const
{
setupState
}
=
instance
;
const
refValue
=
ref
.
$vm
||
ref
;
const
refValue
=
ref
.
$vm
||
ref
;
if
(
refName
)
{
if
(
refName
)
{
if
(
isString
(
refName
))
{
if
(
isString
(
refName
))
{
refs
[
refName
]
=
refValue
;
refs
[
refName
]
=
refValue
;
if
(
hasOwn
(
instance
.
setupState
,
refName
))
{
if
(
hasOwn
(
setupState
,
refName
))
{
instance
.
setupState
[
refName
]
=
refValue
;
setupState
[
refName
]
=
refValue
;
}
}
}
}
else
{
else
{
setRef
(
refName
,
refValue
,
refs
);
setRef
(
refName
,
refValue
,
refs
,
setupState
);
}
}
}
}
else
if
(
refInForName
)
{
else
if
(
refInForName
)
{
...
@@ -738,16 +740,22 @@ function handleRef(ref) {
...
@@ -738,16 +740,22 @@ function handleRef(ref) {
(
refs
[
refInForName
]
||
(
refs
[
refInForName
]
=
[])).
push
(
refValue
);
(
refs
[
refInForName
]
||
(
refs
[
refInForName
]
=
[])).
push
(
refValue
);
}
}
else
{
else
{
setRef
(
refInForName
,
refValue
,
refs
);
setRef
(
refInForName
,
refValue
,
refs
,
setupState
);
}
}
}
}
}
}
function
setRef
(
ref
,
refValue
,
refs
)
{
function
isTemplateRef
(
opts
)
{
return
!!
(
opts
&&
opts
.
r
);
}
function
setRef
(
ref
,
refValue
,
refs
,
setupState
)
{
if
(
isRef
(
ref
))
{
if
(
isRef
(
ref
))
{
ref
.
value
=
refValue
;
ref
.
value
=
refValue
;
}
}
else
if
(
isFunction
(
ref
))
{
else
if
(
isFunction
(
ref
))
{
ref
(
refValue
,
refs
);
const
templateRef
=
ref
(
refValue
,
refs
);
if
(
isTemplateRef
(
templateRef
))
{
setTemplateRef
(
templateRef
,
refValue
,
setupState
);
}
}
}
}
}
function
triggerEvent
(
type
,
detail
)
{
function
triggerEvent
(
type
,
detail
)
{
...
...
packages/uni-mp-alipay/src/runtime/util.ts
浏览文件 @
531e2e39
import
{
hasOwn
,
isFunction
,
camelize
,
EMPTY_OBJ
,
isString
}
from
'
@vue/shared
'
import
{
hasOwn
,
isFunction
,
camelize
,
isArray
,
isString
,
remove
,
}
from
'
@vue/shared
'
import
{
import
{
ComponentPublicInstance
,
ComponentPublicInstance
,
...
@@ -7,8 +14,9 @@ import {
...
@@ -7,8 +14,9 @@ import {
isRef
,
isRef
,
Ref
,
Ref
,
}
from
'
vue
'
}
from
'
vue
'
// @ts-ignore
import
{
findComponentPropsData
}
from
'
vue
'
// @ts-ignore EMPTY_OBJ 不能从 @vue/shared 中引入,从 vue 中导入,保持一致
import
{
findComponentPropsData
,
EMPTY_OBJ
,
setTemplateRef
}
from
'
vue
'
import
{
import
{
initMocks
,
initMocks
,
...
@@ -20,7 +28,6 @@ import {
...
@@ -20,7 +28,6 @@ import {
import
{
handleLink
as
handleBaseLink
}
from
'
@dcloudio/uni-mp-weixin
'
import
{
handleLink
as
handleBaseLink
}
from
'
@dcloudio/uni-mp-weixin
'
import
deepEqual
from
'
./deepEqual
'
import
{
ON_READY
}
from
'
@dcloudio/uni-shared
'
import
{
ON_READY
}
from
'
@dcloudio/uni-shared
'
type
MPPageInstance
=
tinyapp
.
IPageInstance
<
Record
<
string
,
any
>>
type
MPPageInstance
=
tinyapp
.
IPageInstance
<
Record
<
string
,
any
>>
...
@@ -142,34 +149,54 @@ export function handleRef(this: MPComponentInstance, ref: MPComponentInstance) {
...
@@ -142,34 +149,54 @@ export function handleRef(this: MPComponentInstance, ref: MPComponentInstance) {
const
refs
=
const
refs
=
instance
.
refs
===
EMPTY_OBJ
?
(
instance
.
refs
=
{})
:
instance
.
refs
instance
.
refs
===
EMPTY_OBJ
?
(
instance
.
refs
=
{})
:
instance
.
refs
const
{
setupState
}
=
instance
const
refValue
=
ref
.
$vm
||
ref
const
refValue
=
ref
.
$vm
||
ref
if
(
refName
)
{
if
(
refName
)
{
if
(
isString
(
refName
))
{
if
(
isString
(
refName
))
{
refs
[
refName
]
=
refValue
refs
[
refName
]
=
refValue
if
(
hasOwn
(
instance
.
setupState
,
refName
))
{
if
(
hasOwn
(
setupState
,
refName
))
{
instance
.
setupState
[
refName
]
=
refValue
setupState
[
refName
]
=
refValue
}
}
}
else
{
}
else
{
setRef
(
refName
,
refValue
,
refs
)
setRef
(
refName
,
refValue
,
refs
,
setupState
)
}
}
}
else
if
(
refInForName
)
{
}
else
if
(
refInForName
)
{
if
(
isString
(
refInForName
))
{
if
(
isString
(
refInForName
))
{
;(
refs
[
refInForName
]
||
(
refs
[
refInForName
]
=
[])).
push
(
refValue
)
;(
refs
[
refInForName
]
||
(
refs
[
refInForName
]
=
[])).
push
(
refValue
)
}
else
{
}
else
{
setRef
(
refInForName
,
refValue
,
refs
)
setRef
(
refInForName
,
refValue
,
refs
,
setupState
)
}
}
}
}
}
}
type
VNodeRef
=
|
string
|
Ref
|
((
ref
:
object
|
null
,
refs
:
Record
<
string
,
any
>
)
=>
void
)
type
TemplateRef
=
{
r
:
VNodeRef
k
?:
string
// setup ref key
f
?:
boolean
// refInFor marker
}
function
isTemplateRef
(
opts
:
unknown
):
opts
is
TemplateRef
{
return
!!
(
opts
&&
(
opts
as
TemplateRef
).
r
)
}
function
setRef
(
function
setRef
(
ref
:
Ref
|
((
ref
:
object
|
null
,
refs
:
Record
<
string
,
any
>
)
=>
void
),
ref
:
Ref
|
((
ref
:
object
|
null
,
refs
:
Record
<
string
,
any
>
)
=>
void
),
refValue
:
Object
,
refValue
:
ComponentPublicInstance
,
refs
:
Record
<
string
,
unknown
>
refs
:
Record
<
string
,
unknown
>
,
setupState
:
Data
)
{
)
{
if
(
isRef
(
ref
))
{
if
(
isRef
(
ref
))
{
ref
.
value
=
refValue
ref
.
value
=
refValue
}
else
if
(
isFunction
(
ref
))
{
}
else
if
(
isFunction
(
ref
))
{
ref
(
refValue
,
refs
)
const
templateRef
=
ref
(
refValue
,
refs
)
if
(
isTemplateRef
(
templateRef
))
{
setTemplateRef
(
templateRef
,
refValue
,
setupState
)
}
}
}
}
}
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
531e2e39
...
@@ -228,6 +228,7 @@ function initBaseInstance(instance, options) {
...
@@ -228,6 +228,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
mp-baidu
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
...
packages/uni-mp-compiler/__tests__/ref.spec.ts
浏览文件 @
531e2e39
...
@@ -50,7 +50,7 @@ const __BINDING_COMPONENTS__ = '{"custom":{"name":"_component_custom","type":"un
...
@@ -50,7 +50,7 @@ const __BINDING_COMPONENTS__ = '{"custom":{"name":"_component_custom","type":"un
if (!Array) {const _component_custom = _resolveComponent("custom");Math.max.call(null, _component_custom);}
if (!Array) {const _component_custom = _resolveComponent("custom");Math.max.call(null, _component_custom);}
export function render(_ctx, _cache) {
export function render(_ctx, _cache) {
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr('custom', '2a9ec0b0-0' + '-' + i0), b: '2a9ec0b0-0' + '-' + i0 }; }) }
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr('custom', '2a9ec0b0-0' + '-' + i0
, { "f": 1 }
), b: '2a9ec0b0-0' + '-' + i0 }; }) }
}`
,
}`
,
{
{
inline
:
false
,
inline
:
false
,
...
@@ -63,7 +63,7 @@ export function render(_ctx, _cache) {
...
@@ -63,7 +63,7 @@ export function render(_ctx, _cache) {
`<custom ref="custom"/>`
,
`<custom ref="custom"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: _sr(
(_value, _refs) => { _refs['custom'] = _value; }
, '2a9ec0b0-0') }
return { a: _sr(
'custom'
, '2a9ec0b0-0') }
}`
,
}`
,
{
{
nodeTransforms
,
nodeTransforms
,
...
@@ -73,7 +73,7 @@ export function render(_ctx, _cache) {
...
@@ -73,7 +73,7 @@ export function render(_ctx, _cache) {
`<custom v-for="item in items" ref="custom"/>`
,
`<custom v-for="item in items" ref="custom"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="r-i-f" u-r="custom" u-i="{{item.b}}"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="r-i-f" u-r="custom" u-i="{{item.b}}"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr(
(_value, _refs) => { _refs['custom'] = _value; }, '2a9ec0b0-0' + '-' + i0
), b: '2a9ec0b0-0' + '-' + i0 }; }) }
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr(
'custom', '2a9ec0b0-0' + '-' + i0, { "f": 1 }
), b: '2a9ec0b0-0' + '-' + i0 }; }) }
}`
,
}`
,
{
{
nodeTransforms
,
nodeTransforms
,
...
@@ -85,7 +85,7 @@ export function render(_ctx, _cache) {
...
@@ -85,7 +85,7 @@ export function render(_ctx, _cache) {
`<custom ref="custom"/>`
,
`<custom ref="custom"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: _sr(
(_value, _refs) => { _refs['custom'] = _value; custom.value = _value; }, '2a9ec0b0-0'
) }
return { a: _sr(
custom, '2a9ec0b0-0', { "k": "custom" }
) }
}`
,
}`
,
{
{
bindingMetadata
:
{
bindingMetadata
:
{
...
@@ -100,7 +100,7 @@ export function render(_ctx, _cache) {
...
@@ -100,7 +100,7 @@ export function render(_ctx, _cache) {
`<custom ref="custom"/>`
,
`<custom ref="custom"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: _sr(
(_value, _refs) => { _refs['custom'] = _value; _isRef(custom) && (custom.value = _value); }, '2a9ec0b0-0'
) }
return { a: _sr(
custom, '2a9ec0b0-0', { "k": "custom" }
) }
}`
,
}`
,
{
{
bindingMetadata
:
{
bindingMetadata
:
{
...
@@ -115,7 +115,7 @@ export function render(_ctx, _cache) {
...
@@ -115,7 +115,7 @@ export function render(_ctx, _cache) {
`<custom ref="custom"/>`
,
`<custom ref="custom"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`<custom class="r" u-r="custom" u-i="2a9ec0b0-0"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: _sr(
(_value, _refs) => { _refs['custom'] = _value; _isRef(custom) ? custom.value = _value : custom = _value; }, '2a9ec0b0-0'
) }
return { a: _sr(
custom, '2a9ec0b0-0', { "k": "custom" }
) }
}`
,
}`
,
{
{
bindingMetadata
:
{
bindingMetadata
:
{
...
@@ -149,7 +149,7 @@ const __BINDING_COMPONENTS__ = '{"custom":{"name":"_component_custom","type":"un
...
@@ -149,7 +149,7 @@ const __BINDING_COMPONENTS__ = '{"custom":{"name":"_component_custom","type":"un
if (!Array) {const _component_custom = _resolveComponent("custom");Math.max.call(null, _component_custom);}
if (!Array) {const _component_custom = _resolveComponent("custom");Math.max.call(null, _component_custom);}
export function render(_ctx, _cache) {
export function render(_ctx, _cache) {
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr(_ctx.custom, '2a9ec0b0-0' + '-' + i0), b: '2a9ec0b0-0' + '-' + i0 }; }), b: _ctx.custom }
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr(_ctx.custom, '2a9ec0b0-0' + '-' + i0
, { "f": 1 }
), b: '2a9ec0b0-0' + '-' + i0 }; }), b: _ctx.custom }
}`
,
}`
,
{
{
inline
:
false
,
inline
:
false
,
...
@@ -172,7 +172,7 @@ export function render(_ctx, _cache) {
...
@@ -172,7 +172,7 @@ export function render(_ctx, _cache) {
`<custom v-for="item in items" :ref="custom"/>`
,
`<custom v-for="item in items" :ref="custom"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="r-i-f" u-r="{{b}}" u-i="{{item.b}}"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="r-i-f" u-r="{{b}}" u-i="{{item.b}}"/>`
,
`(_ctx, _cache) => {
`(_ctx, _cache) => {
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr(_ctx.custom, '2a9ec0b0-0' + '-' + i0), b: '2a9ec0b0-0' + '-' + i0 }; }), b: _ctx.custom }
return { a: _f(_ctx.items, (item, k0, i0) => { return { a: _sr(_ctx.custom, '2a9ec0b0-0' + '-' + i0
, { "f": 1 }
), b: '2a9ec0b0-0' + '-' + i0 }; }), b: _ctx.custom }
}`
,
}`
,
{
{
nodeTransforms
,
nodeTransforms
,
...
...
packages/uni-mp-compiler/src/transforms/transformRef.ts
浏览文件 @
531e2e39
import
{
import
{
arrowFunctionExpression
,
arrowFunctionExpression
,
assignmentExpression
,
blockStatement
,
callExpression
,
conditionalExpression
,
Expression
,
Expression
,
expressionStatement
,
identifier
,
identifier
,
logicalExpression
,
objectExpression
,
memberExpression
,
objectProperty
,
Statement
,
ObjectProperty
,
numericLiteral
,
stringLiteral
,
stringLiteral
,
}
from
'
@babel/types
'
}
from
'
@babel/types
'
import
{
import
{
AttributeNode
,
AttributeNode
,
BindingTypes
,
DirectiveNode
,
DirectiveNode
,
ElementNode
,
ElementNode
,
findProp
,
findProp
,
IS_REF
,
}
from
'
@vue/compiler-core
'
}
from
'
@vue/compiler-core
'
import
{
import
{
createBindDirectiveNode
,
createBindDirectiveNode
,
...
@@ -45,7 +39,7 @@ export function rewriteRef(node: ElementNode, context: TransformContext) {
...
@@ -45,7 +39,7 @@ export function rewriteRef(node: ElementNode, context: TransformContext) {
}
}
if
(
findProp
(
node
,
'
ref
'
))
{
if
(
findProp
(
node
,
'
ref
'
))
{
// 支付宝小程序
// 支付宝小程序
const
code
=
parse
RefCode
(
refProp
,
vueId
Prop
,
context
)
const
code
=
parse
AlipayRefCode
(
ref
Prop
,
context
)
if
(
code
&&
context
.
inline
&&
!
isDirectiveNode
(
refProp
))
{
if
(
code
&&
context
.
inline
&&
!
isDirectiveNode
(
refProp
))
{
refProp
.
value
!
.
content
=
code
refProp
.
value
!
.
content
=
code
const
refPropIndex
=
node
.
props
.
findIndex
((
prop
)
=>
prop
===
refProp
)
const
refPropIndex
=
node
.
props
.
findIndex
((
prop
)
=>
prop
===
refProp
)
...
@@ -60,29 +54,40 @@ export function rewriteRef(node: ElementNode, context: TransformContext) {
...
@@ -60,29 +54,40 @@ export function rewriteRef(node: ElementNode, context: TransformContext) {
}
}
}
}
function
parseRef
Code
(
function
parseRef
(
prop
:
AttributeNode
|
DirectiveNode
,
prop
:
AttributeNode
|
DirectiveNode
,
vueIdProp
:
AttributeNode
|
DirectiveNode
,
context
:
TransformContext
context
:
TransformContext
)
{
)
{
let
expr
:
Expression
|
undefined
let
expr
:
Expression
|
undefined
let
refKey
=
''
const
isDir
=
isDirectiveNode
(
prop
)
const
isDir
=
isDirectiveNode
(
prop
)
if
(
isDir
)
{
if
(
isDir
)
{
if
(
prop
.
exp
)
{
if
(
prop
.
exp
)
{
expr
=
parseExpr
(
prop
.
exp
,
context
,
prop
.
exp
)
expr
=
parseExpr
(
prop
.
exp
,
context
,
prop
.
exp
)
}
}
}
else
{
}
else
{
if
(
prop
.
value
?.
content
)
{
const
{
value
}
=
prop
expr
=
context
.
inline
if
(
value
&&
value
.
content
)
{
?
processInlineRef
(
context
,
prop
.
value
.
content
)
if
(
context
.
inline
&&
context
.
bindingMetadata
[
value
.
content
])
{
:
stringLiteral
(
prop
.
value
.
content
)
expr
=
identifier
(
value
.
content
)
refKey
=
value
.
content
}
else
{
expr
=
stringLiteral
(
value
.
content
)
}
}
}
}
}
return
{
expr
,
refKey
}
}
function
parseRefCode
(
prop
:
AttributeNode
|
DirectiveNode
,
context
:
TransformContext
)
{
const
{
expr
,
refKey
}
=
parseRef
(
prop
,
context
)
if
(
!
expr
)
{
if
(
!
expr
)
{
return
return
{
code
:
''
,
refKey
}
}
}
return
genBabelExpr
(
expr
)
return
{
code
:
genBabelExpr
(
expr
),
refKey
}
}
}
function
rewriteRefProp
(
function
rewriteRefProp
(
...
@@ -102,72 +107,62 @@ function rewriteRefProp(
...
@@ -102,72 +107,62 @@ function rewriteRefProp(
if
(
!
id
)
{
if
(
!
id
)
{
return
return
}
}
const
{
code
,
refKey
}
=
parseRefCode
(
prop
,
context
)
const
opts
=
Object
.
create
(
null
)
if
(
refKey
)
{
opts
.
k
=
refKey
}
if
(
context
.
inVFor
)
{
opts
.
f
=
1
}
parseExprWithRewrite
(
parseExprWithRewrite
(
context
.
helperString
(
SET_REF
)
+
context
.
helperString
(
SET_REF
)
+
'
(
'
+
'
(
'
+
parseRefCode
(
prop
,
vueIdProp
,
context
)
+
code
+
'
,
'
+
'
,
'
+
id
+
id
+
(
Object
.
keys
(
opts
).
length
?
'
,
'
+
JSON
.
stringify
(
opts
)
:
''
)
+
'
)
'
,
'
)
'
,
prop
.
loc
,
prop
.
loc
,
context
context
)
)
}
}
function
processInlineRef
(
context
:
TransformContext
,
raw
:
string
)
{
function
parseAlipayRefCode
(
const
statements
:
Statement
[]
=
[]
prop
:
AttributeNode
|
DirectiveNode
,
statements
.
push
(
context
:
TransformContext
expressionStatement
(
)
{
assignmentExpression
(
let
expr
:
Expression
|
undefined
'
=
'
,
const
isDir
=
isDirectiveNode
(
prop
)
memberExpression
(
identifier
(
'
_refs
'
),
stringLiteral
(
raw
),
true
),
if
(
isDir
)
{
identifier
(
'
_value
'
)
if
(
prop
.
exp
)
{
)
expr
=
parseExpr
(
prop
.
exp
,
context
,
prop
.
exp
)
)
}
)
}
else
{
const
{
bindingMetadata
,
helperString
}
=
context
if
(
prop
.
value
?.
content
)
{
const
type
=
bindingMetadata
[
raw
]
expr
=
context
.
inline
if
(
type
===
BindingTypes
.
SETUP_REF
)
{
?
processInlineRef
(
prop
,
context
)
statements
.
push
(
:
stringLiteral
(
prop
.
value
.
content
)
expressionStatement
(
}
assignmentExpression
(
}
'
=
'
,
memberExpression
(
identifier
(
raw
),
identifier
(
'
value
'
)),
if
(
!
expr
)
{
identifier
(
'
_value
'
)
return
)
)
)
}
else
if
(
type
===
BindingTypes
.
SETUP_MAYBE_REF
)
{
statements
.
push
(
expressionStatement
(
logicalExpression
(
'
&&
'
,
callExpression
(
identifier
(
helperString
(
IS_REF
)),
[
identifier
(
raw
)]),
assignmentExpression
(
'
=
'
,
memberExpression
(
identifier
(
raw
),
identifier
(
'
value
'
)),
identifier
(
'
_value
'
)
)
)
)
)
}
else
if
(
type
===
BindingTypes
.
SETUP_LET
)
{
statements
.
push
(
expressionStatement
(
conditionalExpression
(
callExpression
(
identifier
(
helperString
(
IS_REF
)),
[
identifier
(
raw
)]),
assignmentExpression
(
'
=
'
,
memberExpression
(
identifier
(
raw
),
identifier
(
'
value
'
)),
identifier
(
'
_value
'
)
),
assignmentExpression
(
'
=
'
,
identifier
(
raw
),
identifier
(
'
_value
'
))
)
)
)
}
}
return
arrowFunctionExpression
(
return
genBabelExpr
(
expr
)
[
identifier
(
'
_value
'
),
identifier
(
'
_refs
'
)],
}
blockStatement
(
statements
)
function
processInlineRef
(
prop
:
AttributeNode
,
context
:
TransformContext
)
{
const
properties
:
ObjectProperty
[]
=
[]
const
{
refKey
}
=
parseRef
(
prop
,
context
)
properties
.
push
(
objectProperty
(
identifier
(
'
r
'
),
identifier
(
prop
.
value
!
.
content
))
)
)
if
(
refKey
)
{
properties
.
push
(
objectProperty
(
identifier
(
'
k
'
),
stringLiteral
(
refKey
)))
}
if
(
context
.
inVFor
)
{
properties
.
push
(
objectProperty
(
identifier
(
'
f
'
),
numericLiteral
(
1
)))
}
return
arrowFunctionExpression
([],
objectExpression
(
properties
))
}
}
packages/uni-mp-core/src/runtime/componentInstance.ts
浏览文件 @
531e2e39
...
@@ -61,6 +61,7 @@ export function initBaseInstance(
...
@@ -61,6 +61,7 @@ export function initBaseInstance(
// mp
// mp
ctx
.
mpType
=
options
.
mpType
// @deprecated
ctx
.
mpType
=
options
.
mpType
// @deprecated
ctx
.
$mpType
=
options
.
mpType
ctx
.
$mpType
=
options
.
mpType
ctx
.
$mpPlatform
=
__PLATFORM__
ctx
.
$scope
=
options
.
mpInstance
ctx
.
$scope
=
options
.
mpInstance
// TODO @deprecated
// TODO @deprecated
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
531e2e39
...
@@ -223,6 +223,7 @@ function initBaseInstance(instance, options) {
...
@@ -223,6 +223,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
mp-kuaishou
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
...
packages/uni-mp-lark/dist/uni.mp.esm.js
浏览文件 @
531e2e39
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
mp-lark
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
531e2e39
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
mp-qq
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
531e2e39
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
mp-toutiao
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
...
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
531e2e39
import
{
extend
,
isSymbol
,
isObject
,
toRawType
,
def
,
hasChanged
,
isArray
,
isFunction
,
NOOP
,
remove
,
toHandlerKey
,
hasOwn
,
camelize
,
hyphenate
,
isReservedProp
,
capitalize
,
isString
,
normalizeClass
,
normalizeStyle
,
isOn
,
isPromise
,
EMPTY_OBJ
,
isSet
,
isMap
,
isPlainObject
,
toTypeString
,
isIntegerKey
,
makeMap
,
invokeArrayFns
,
NO
,
toNumber
,
EMPTY_ARR
,
stringifyStyle
as
stringifyStyle$1
,
toDisplayString
}
from
'
@vue/shared
'
;
import
{
extend
,
isSymbol
,
isObject
,
toRawType
,
def
,
hasChanged
,
isArray
,
isFunction
,
NOOP
,
remove
,
toHandlerKey
,
hasOwn
,
camelize
,
hyphenate
,
isReservedProp
,
capitalize
,
isString
,
normalizeClass
,
normalizeStyle
,
isOn
,
isPromise
,
EMPTY_OBJ
,
isSet
,
isMap
,
isPlainObject
,
toTypeString
,
isIntegerKey
,
makeMap
,
invokeArrayFns
,
NO
,
toNumber
,
EMPTY_ARR
,
stringifyStyle
as
stringifyStyle$1
,
toDisplayString
}
from
'
@vue/shared
'
;
export
{
camelize
,
normalizeClass
,
normalizeProps
,
normalizeStyle
,
toDisplayString
,
toHandlerKey
}
from
'
@vue/shared
'
;
export
{
EMPTY_OBJ
,
camelize
,
normalizeClass
,
normalizeProps
,
normalizeStyle
,
toDisplayString
,
toHandlerKey
}
from
'
@vue/shared
'
;
import
{
isRootHook
,
getValueByDataPath
,
ON_ERROR
,
UniLifecycleHooks
,
dynamicSlotName
}
from
'
@dcloudio/uni-shared
'
;
import
{
isRootHook
,
getValueByDataPath
,
ON_ERROR
,
UniLifecycleHooks
,
dynamicSlotName
}
from
'
@dcloudio/uni-shared
'
;
function
warn
(
msg
,
...
args
)
{
function
warn
(
msg
,
...
args
)
{
...
@@ -4704,6 +4704,86 @@ function onApplyOptions(options, instance, publicThis) {
...
@@ -4704,6 +4704,86 @@ function onApplyOptions(options, instance, publicThis) {
delete
instance
.
ctx
.
$onApplyOptions
;
delete
instance
.
ctx
.
$onApplyOptions
;
}
}
/**
* Function for handling a template ref
*/
function
setRef$1
(
instance
,
isUnmount
=
false
)
{
const
{
setupState
,
$templateRefs
,
ctx
:
{
$scope
,
$mpPlatform
}
}
=
instance
;
if
(
$mpPlatform
===
'
mp-alipay
'
)
{
return
;
}
if
(
!
$templateRefs
||
!
$scope
)
{
return
;
}
if
(
isUnmount
)
{
return
$templateRefs
.
forEach
(
templateRef
=>
setTemplateRef
(
templateRef
,
null
,
setupState
));
}
const
doSet
=
()
=>
{
const
mpComponents
=
$scope
.
selectAllComponents
(
'
.r
'
)
.
concat
(
$scope
.
selectAllComponents
(
'
.r-i-f
'
));
$templateRefs
.
forEach
(
templateRef
=>
setTemplateRef
(
templateRef
,
findComponentPublicInstance
(
mpComponents
,
templateRef
.
i
),
setupState
));
};
if
(
$scope
.
_$setRef
)
{
$scope
.
_$setRef
(
doSet
);
}
else
{
nextTick$1
(
instance
,
doSet
);
}
}
function
findComponentPublicInstance
(
mpComponents
,
id
)
{
const
mpInstance
=
mpComponents
.
find
(
com
=>
com
&&
(
com
.
properties
||
com
.
props
).
uI
===
id
);
if
(
mpInstance
)
{
return
mpInstance
.
$vm
;
}
return
null
;
}
function
setTemplateRef
({
r
,
f
},
refValue
,
setupState
)
{
if
(
isFunction
(
r
))
{
r
(
refValue
,
{});
}
else
{
const
_isString
=
isString
(
r
);
const
_isRef
=
isRef
(
r
);
if
(
_isString
||
_isRef
)
{
if
(
f
)
{
if
(
!
_isRef
)
{
return
;
}
if
(
!
isArray
(
r
.
value
))
{
r
.
value
=
[];
}
const
existing
=
r
.
value
;
if
(
existing
.
indexOf
(
refValue
)
===
-
1
)
{
existing
.
push
(
refValue
);
if
(
!
refValue
)
{
return
;
}
// 实例销毁时,移除
onBeforeUnmount
(()
=>
remove
(
existing
,
refValue
),
refValue
.
$
);
}
}
else
if
(
_isString
)
{
if
(
hasOwn
(
setupState
,
r
))
{
setupState
[
r
]
=
refValue
;
}
}
else
if
(
isRef
(
r
))
{
r
.
value
=
refValue
;
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warnRef
(
r
);
}
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warnRef
(
r
);
}
}
}
function
warnRef
(
ref
)
{
warn$1
(
'
Invalid template ref type:
'
,
ref
,
`(
${
typeof
ref
}
)`
);
}
var
MPType
;
var
MPType
;
(
function
(
MPType
)
{
(
function
(
MPType
)
{
MPType
[
"
APP
"
]
=
"
app
"
;
MPType
[
"
APP
"
]
=
"
app
"
;
...
@@ -4751,6 +4831,7 @@ const getFunctionalFallthrough = (attrs) => {
...
@@ -4751,6 +4831,7 @@ const getFunctionalFallthrough = (attrs) => {
};
};
function
renderComponentRoot
(
instance
)
{
function
renderComponentRoot
(
instance
)
{
const
{
type
:
Component
,
vnode
,
proxy
,
withProxy
,
props
,
slots
,
attrs
,
emit
,
render
,
renderCache
,
data
,
setupState
,
ctx
,
uid
,
appContext
:
{
app
:
{
config
:
{
globalProperties
:
{
pruneComponentPropsCache
}
}
}
}
}
=
instance
;
const
{
type
:
Component
,
vnode
,
proxy
,
withProxy
,
props
,
slots
,
attrs
,
emit
,
render
,
renderCache
,
data
,
setupState
,
ctx
,
uid
,
appContext
:
{
app
:
{
config
:
{
globalProperties
:
{
pruneComponentPropsCache
}
}
}
}
}
=
instance
;
instance
.
$templateRefs
=
[];
instance
.
$ei
=
0
;
instance
.
$ei
=
0
;
// props
// props
pruneComponentPropsCache
(
uid
);
pruneComponentPropsCache
(
uid
);
...
@@ -4780,6 +4861,7 @@ function renderComponentRoot(instance) {
...
@@ -4780,6 +4861,7 @@ function renderComponentRoot(instance) {
handleError
(
err
,
instance
,
1
/* RENDER_FUNCTION */
);
handleError
(
err
,
instance
,
1
/* RENDER_FUNCTION */
);
result
=
false
;
result
=
false
;
}
}
setRef$1
(
instance
);
setCurrentRenderingInstance
(
prev
);
setCurrentRenderingInstance
(
prev
);
return
result
;
return
result
;
}
}
...
@@ -4837,6 +4919,9 @@ function setupRenderEffect(instance) {
...
@@ -4837,6 +4919,9 @@ function setupRenderEffect(instance) {
instance
.
$updateScopedSlots
=
()
=>
nextTick
(()
=>
queueJob
(
updateScopedSlots
));
instance
.
$updateScopedSlots
=
()
=>
nextTick
(()
=>
queueJob
(
updateScopedSlots
));
const
componentUpdateFn
=
()
=>
{
const
componentUpdateFn
=
()
=>
{
if
(
!
instance
.
isMounted
)
{
if
(
!
instance
.
isMounted
)
{
onBeforeUnmount
(()
=>
{
setRef$1
(
instance
,
true
);
},
instance
);
patch
(
instance
,
renderComponentRoot
(
instance
));
patch
(
instance
,
renderComponentRoot
(
instance
));
}
}
else
{
else
{
...
@@ -5391,40 +5476,9 @@ function dynamicSlot(names) {
...
@@ -5391,40 +5476,9 @@ function dynamicSlot(names) {
return
names
.
map
((
name
)
=>
dynamicSlotName
(
name
));
return
names
.
map
((
name
)
=>
dynamicSlotName
(
name
));
}
}
function
setRef
(
ref
,
id
)
{
function
setRef
(
ref
,
id
,
opts
=
{})
{
const
{
proxy
,
ctx
:
{
$scope
},
setupState
,
}
=
getCurrentInstance
();
const
{
$templateRefs
}
=
getCurrentInstance
();
const
doSet
=
()
=>
{
$templateRefs
.
push
({
i
:
id
,
r
:
ref
,
k
:
opts
.
k
,
f
:
opts
.
f
});
let
mpInstance
=
$scope
.
selectAllComponents
(
'
.r
'
)
.
find
((
com
)
=>
com
&&
com
.
properties
.
uI
===
id
);
if
(
!
mpInstance
)
{
mpInstance
=
$scope
.
selectAllComponents
(
'
.r-i-f
'
)
.
find
((
com
)
=>
com
&&
com
.
properties
.
uI
===
id
);
}
if
(
!
mpInstance
)
{
return
;
}
// TODO 目前 $refs 实时从selectAllComponents中获取,不在 setRef 中对 $refs 做处理
const
refValue
=
mpInstance
.
$vm
;
if
(
isString
(
ref
))
{
if
(
hasOwn
(
setupState
,
ref
))
{
setupState
[
ref
]
=
refValue
;
}
}
else
if
(
isRef
(
ref
))
{
ref
.
value
=
refValue
;
}
else
if
(
isFunction
(
ref
))
{
ref
(
refValue
,
{});
}
};
if
(
$scope
.
_$setRef
)
{
$scope
.
_$setRef
(
doSet
);
}
else
{
proxy
.
$nextTick
(
doSet
);
}
}
}
function
setupDevtoolsPlugin
()
{
function
setupDevtoolsPlugin
()
{
...
@@ -5443,7 +5497,7 @@ const h = (str) => hyphenate(str);
...
@@ -5443,7 +5497,7 @@ const h = (str) => hyphenate(str);
const
n
=
(
value
)
=>
normalizeClass
(
value
);
const
n
=
(
value
)
=>
normalizeClass
(
value
);
const
t
=
(
val
)
=>
toDisplayString
(
val
);
const
t
=
(
val
)
=>
toDisplayString
(
val
);
const
p
=
(
props
)
=>
renderProps
(
props
);
const
p
=
(
props
)
=>
renderProps
(
props
);
const
sr
=
(
ref
,
id
)
=>
setRef
(
ref
,
id
);
const
sr
=
(
ref
,
id
,
opts
)
=>
setRef
(
ref
,
id
,
opts
);
function
createApp
(
rootComponent
,
rootProps
=
null
)
{
function
createApp
(
rootComponent
,
rootProps
=
null
)
{
rootComponent
&&
(
rootComponent
.
mpType
=
'
app
'
);
rootComponent
&&
(
rootComponent
.
mpType
=
'
app
'
);
...
@@ -5451,4 +5505,4 @@ function createApp(rootComponent, rootProps = null) {
...
@@ -5451,4 +5505,4 @@ function createApp(rootComponent, rootProps = null) {
}
}
const
createSSRApp
=
createApp
;
const
createSSRApp
=
createApp
;
export
{
EffectScope
,
Fragment
,
ReactiveEffect
,
Text
,
c
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
computed
,
createApp
,
createSSRApp
,
createVNode$1
as
createVNode
,
createVueApp
,
customRef
,
d
,
defineAsyncComponent
,
defineComponent
,
defineEmits
,
defineExpose
,
defineProps
,
diff
,
e
,
effect
,
effectScope
,
f
,
findComponentPropsData
,
getCurrentInstance
,
getCurrentScope
,
guardReactiveProps
,
h
,
inject
,
injectHook
,
invalidateJob
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
logError
,
markRaw
,
mergeDefaults
,
mergeProps
,
n
,
nextTick
,
o
,
onActivated
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onErrorCaptured
,
onMounted
,
onRenderTracked
,
onRenderTriggered
,
onScopeDispose
,
onServerPrefetch
,
onUnmounted
,
onUpdated
,
p
,
patch
,
provide
,
proxyRefs
,
pruneComponentPropsCache
,
queuePostFlushCb
,
r
,
reactive
,
readonly
,
ref
,
resolveComponent
,
resolveDirective
,
resolveFilter
,
s
,
setCurrentRenderingInstance
,
setupDevtoolsPlugin
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
sr
,
stop
,
t
,
toHandlers
,
toRaw
,
toRef
,
toRefs
,
triggerRef
,
unref
,
updateProps
,
useAttrs
,
useCssModule
,
useCssVars
,
useSSRContext
,
useSlots
,
version
,
w
,
warn$1
as
warn
,
watch
,
watchEffect
,
watchPostEffect
,
watchSyncEffect
,
withAsyncContext
,
withCtx
,
withDefaults
,
withDirectives
,
withModifiers
,
withScopeId
};
export
{
EffectScope
,
Fragment
,
ReactiveEffect
,
Text
,
c
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
computed
,
createApp
,
createSSRApp
,
createVNode$1
as
createVNode
,
createVueApp
,
customRef
,
d
,
defineAsyncComponent
,
defineComponent
,
defineEmits
,
defineExpose
,
defineProps
,
diff
,
e
,
effect
,
effectScope
,
f
,
findComponentPropsData
,
getCurrentInstance
,
getCurrentScope
,
guardReactiveProps
,
h
,
inject
,
injectHook
,
invalidateJob
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
logError
,
markRaw
,
mergeDefaults
,
mergeProps
,
n
,
nextTick
,
o
,
onActivated
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onErrorCaptured
,
onMounted
,
onRenderTracked
,
onRenderTriggered
,
onScopeDispose
,
onServerPrefetch
,
onUnmounted
,
onUpdated
,
p
,
patch
,
provide
,
proxyRefs
,
pruneComponentPropsCache
,
queuePostFlushCb
,
r
,
reactive
,
readonly
,
ref
,
resolveComponent
,
resolveDirective
,
resolveFilter
,
s
,
setCurrentRenderingInstance
,
set
TemplateRef
,
set
upDevtoolsPlugin
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
sr
,
stop
,
t
,
toHandlers
,
toRaw
,
toRef
,
toRefs
,
triggerRef
,
unref
,
updateProps
,
useAttrs
,
useCssModule
,
useCssVars
,
useSSRContext
,
useSlots
,
version
,
w
,
warn$1
as
warn
,
watch
,
watchEffect
,
watchPostEffect
,
watchSyncEffect
,
withAsyncContext
,
withCtx
,
withDefaults
,
withDirectives
,
withModifiers
,
withScopeId
};
packages/uni-mp-vue/lib/vue.runtime.esm.js
浏览文件 @
531e2e39
import
{
extend
,
isArray
,
isMap
,
isIntegerKey
,
isSymbol
,
hasOwn
,
isObject
,
hasChanged
,
makeMap
,
capitalize
,
toRawType
,
def
,
isFunction
,
NOOP
,
isOn
,
hyphenate
,
EMPTY_OBJ
,
toHandlerKey
,
toNumber
,
camelize
,
remove
,
isPromise
,
isString
,
isReservedProp
,
EMPTY_ARR
,
NO
,
normalizeClass
,
normalizeStyle
,
isSet
,
isPlainObject
,
toTypeString
,
invokeArrayFns
}
from
'
@vue/shared
'
;
import
{
extend
,
isArray
,
isMap
,
isIntegerKey
,
isSymbol
,
hasOwn
,
isObject
,
hasChanged
,
makeMap
,
capitalize
,
toRawType
,
def
,
isFunction
,
NOOP
,
isOn
,
hyphenate
,
EMPTY_OBJ
,
toHandlerKey
,
toNumber
,
camelize
,
remove
,
isPromise
,
isString
,
isReservedProp
,
EMPTY_ARR
,
NO
,
normalizeClass
,
normalizeStyle
,
isSet
,
isPlainObject
,
toTypeString
,
invokeArrayFns
}
from
'
@vue/shared
'
;
export
{
camelize
,
normalizeClass
,
normalizeProps
,
normalizeStyle
,
toDisplayString
,
toHandlerKey
}
from
'
@vue/shared
'
;
export
{
EMPTY_OBJ
,
camelize
,
normalizeClass
,
normalizeProps
,
normalizeStyle
,
toDisplayString
,
toHandlerKey
}
from
'
@vue/shared
'
;
import
{
isRootHook
,
getValueByDataPath
}
from
'
@dcloudio/uni-shared
'
;
import
{
isRootHook
,
getValueByDataPath
}
from
'
@dcloudio/uni-shared
'
;
function
warn
(
msg
,
...
args
)
{
function
warn
(
msg
,
...
args
)
{
...
@@ -4704,6 +4704,86 @@ function onApplyOptions(options, instance, publicThis) {
...
@@ -4704,6 +4704,86 @@ function onApplyOptions(options, instance, publicThis) {
delete
instance
.
ctx
.
$onApplyOptions
;
delete
instance
.
ctx
.
$onApplyOptions
;
}
}
/**
* Function for handling a template ref
*/
function
setRef
(
instance
,
isUnmount
=
false
)
{
const
{
setupState
,
$templateRefs
,
ctx
:
{
$scope
,
$mpPlatform
}
}
=
instance
;
if
(
$mpPlatform
===
'
mp-alipay
'
)
{
return
;
}
if
(
!
$templateRefs
||
!
$scope
)
{
return
;
}
if
(
isUnmount
)
{
return
$templateRefs
.
forEach
(
templateRef
=>
setTemplateRef
(
templateRef
,
null
,
setupState
));
}
const
doSet
=
()
=>
{
const
mpComponents
=
$scope
.
selectAllComponents
(
'
.r
'
)
.
concat
(
$scope
.
selectAllComponents
(
'
.r-i-f
'
));
$templateRefs
.
forEach
(
templateRef
=>
setTemplateRef
(
templateRef
,
findComponentPublicInstance
(
mpComponents
,
templateRef
.
i
),
setupState
));
};
if
(
$scope
.
_$setRef
)
{
$scope
.
_$setRef
(
doSet
);
}
else
{
nextTick$1
(
instance
,
doSet
);
}
}
function
findComponentPublicInstance
(
mpComponents
,
id
)
{
const
mpInstance
=
mpComponents
.
find
(
com
=>
com
&&
(
com
.
properties
||
com
.
props
).
uI
===
id
);
if
(
mpInstance
)
{
return
mpInstance
.
$vm
;
}
return
null
;
}
function
setTemplateRef
({
r
,
f
},
refValue
,
setupState
)
{
if
(
isFunction
(
r
))
{
r
(
refValue
,
{});
}
else
{
const
_isString
=
isString
(
r
);
const
_isRef
=
isRef
(
r
);
if
(
_isString
||
_isRef
)
{
if
(
f
)
{
if
(
!
_isRef
)
{
return
;
}
if
(
!
isArray
(
r
.
value
))
{
r
.
value
=
[];
}
const
existing
=
r
.
value
;
if
(
existing
.
indexOf
(
refValue
)
===
-
1
)
{
existing
.
push
(
refValue
);
if
(
!
refValue
)
{
return
;
}
// 实例销毁时,移除
onBeforeUnmount
(()
=>
remove
(
existing
,
refValue
),
refValue
.
$
);
}
}
else
if
(
_isString
)
{
if
(
hasOwn
(
setupState
,
r
))
{
setupState
[
r
]
=
refValue
;
}
}
else
if
(
isRef
(
r
))
{
r
.
value
=
refValue
;
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warnRef
(
r
);
}
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warnRef
(
r
);
}
}
}
function
warnRef
(
ref
)
{
warn$1
(
'
Invalid template ref type:
'
,
ref
,
`(
${
typeof
ref
}
)`
);
}
var
MPType
;
var
MPType
;
(
function
(
MPType
)
{
(
function
(
MPType
)
{
MPType
[
"
APP
"
]
=
"
app
"
;
MPType
[
"
APP
"
]
=
"
app
"
;
...
@@ -4751,6 +4831,7 @@ const getFunctionalFallthrough = (attrs) => {
...
@@ -4751,6 +4831,7 @@ const getFunctionalFallthrough = (attrs) => {
};
};
function
renderComponentRoot
(
instance
)
{
function
renderComponentRoot
(
instance
)
{
const
{
type
:
Component
,
vnode
,
proxy
,
withProxy
,
props
,
slots
,
attrs
,
emit
,
render
,
renderCache
,
data
,
setupState
,
ctx
,
uid
,
appContext
:
{
app
:
{
config
:
{
globalProperties
:
{
pruneComponentPropsCache
}
}
}
}
}
=
instance
;
const
{
type
:
Component
,
vnode
,
proxy
,
withProxy
,
props
,
slots
,
attrs
,
emit
,
render
,
renderCache
,
data
,
setupState
,
ctx
,
uid
,
appContext
:
{
app
:
{
config
:
{
globalProperties
:
{
pruneComponentPropsCache
}
}
}
}
}
=
instance
;
instance
.
$templateRefs
=
[];
instance
.
$ei
=
0
;
instance
.
$ei
=
0
;
// props
// props
pruneComponentPropsCache
(
uid
);
pruneComponentPropsCache
(
uid
);
...
@@ -4780,6 +4861,7 @@ function renderComponentRoot(instance) {
...
@@ -4780,6 +4861,7 @@ function renderComponentRoot(instance) {
handleError
(
err
,
instance
,
1
/* RENDER_FUNCTION */
);
handleError
(
err
,
instance
,
1
/* RENDER_FUNCTION */
);
result
=
false
;
result
=
false
;
}
}
setRef
(
instance
);
setCurrentRenderingInstance
(
prev
);
setCurrentRenderingInstance
(
prev
);
return
result
;
return
result
;
}
}
...
@@ -4837,6 +4919,9 @@ function setupRenderEffect(instance) {
...
@@ -4837,6 +4919,9 @@ function setupRenderEffect(instance) {
instance
.
$updateScopedSlots
=
()
=>
nextTick
(()
=>
queueJob
(
updateScopedSlots
));
instance
.
$updateScopedSlots
=
()
=>
nextTick
(()
=>
queueJob
(
updateScopedSlots
));
const
componentUpdateFn
=
()
=>
{
const
componentUpdateFn
=
()
=>
{
if
(
!
instance
.
isMounted
)
{
if
(
!
instance
.
isMounted
)
{
onBeforeUnmount
(()
=>
{
setRef
(
instance
,
true
);
},
instance
);
patch
(
instance
,
renderComponentRoot
(
instance
));
patch
(
instance
,
renderComponentRoot
(
instance
));
}
}
else
{
else
{
...
@@ -4986,4 +5071,4 @@ function initCssVarsRender(instance, getter) {
...
@@ -4986,4 +5071,4 @@ function initCssVarsRender(instance, getter) {
function
withModifiers
()
{
}
function
withModifiers
()
{
}
function
createVNode$1
()
{
}
function
createVNode$1
()
{
}
export
{
EffectScope
,
Fragment
,
ReactiveEffect
,
Text
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
computed
,
createVNode$1
as
createVNode
,
createVueApp
,
customRef
,
defineAsyncComponent
,
defineComponent
,
defineEmits
,
defineExpose
,
defineProps
,
diff
,
effect
,
effectScope
,
getCurrentInstance
,
getCurrentScope
,
guardReactiveProps
,
inject
,
injectHook
,
invalidateJob
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
logError
,
markRaw
,
mergeDefaults
,
mergeProps
,
nextTick
,
onActivated
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onErrorCaptured
,
onMounted
,
onRenderTracked
,
onRenderTriggered
,
onScopeDispose
,
onServerPrefetch
,
onUnmounted
,
onUpdated
,
patch
,
provide
,
proxyRefs
,
queuePostFlushCb
,
reactive
,
readonly
,
ref
,
resolveComponent
,
resolveDirective
,
resolveFilter
,
setCurrentRenderingInstance
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
stop
,
toHandlers
,
toRaw
,
toRef
,
toRefs
,
triggerRef
,
unref
,
updateProps
,
useAttrs
,
useCssModule
,
useCssVars
,
useSSRContext
,
useSlots
,
version
,
warn$1
as
warn
,
watch
,
watchEffect
,
watchPostEffect
,
watchSyncEffect
,
withAsyncContext
,
withCtx
,
withDefaults
,
withDirectives
,
withModifiers
,
withScopeId
};
export
{
EffectScope
,
Fragment
,
ReactiveEffect
,
Text
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
computed
,
createVNode$1
as
createVNode
,
createVueApp
,
customRef
,
defineAsyncComponent
,
defineComponent
,
defineEmits
,
defineExpose
,
defineProps
,
diff
,
effect
,
effectScope
,
getCurrentInstance
,
getCurrentScope
,
guardReactiveProps
,
inject
,
injectHook
,
invalidateJob
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
logError
,
markRaw
,
mergeDefaults
,
mergeProps
,
nextTick
,
onActivated
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onErrorCaptured
,
onMounted
,
onRenderTracked
,
onRenderTriggered
,
onScopeDispose
,
onServerPrefetch
,
onUnmounted
,
onUpdated
,
patch
,
provide
,
proxyRefs
,
queuePostFlushCb
,
reactive
,
readonly
,
ref
,
resolveComponent
,
resolveDirective
,
resolveFilter
,
setCurrentRenderingInstance
,
s
etTemplateRef
,
s
hallowReactive
,
shallowReadonly
,
shallowRef
,
stop
,
toHandlers
,
toRaw
,
toRef
,
toRefs
,
triggerRef
,
unref
,
updateProps
,
useAttrs
,
useCssModule
,
useCssVars
,
useSSRContext
,
useSlots
,
version
,
warn$1
as
warn
,
watch
,
watchEffect
,
watchPostEffect
,
watchSyncEffect
,
withAsyncContext
,
withCtx
,
withDefaults
,
withDirectives
,
withModifiers
,
withScopeId
};
packages/uni-mp-vue/src/helpers/index.ts
浏览文件 @
531e2e39
...
@@ -37,4 +37,4 @@ export const h: typeof hyphenate = (str) => hyphenate(str)
...
@@ -37,4 +37,4 @@ export const h: typeof hyphenate = (str) => hyphenate(str)
export
const
n
:
typeof
normalizeClass
=
(
value
)
=>
normalizeClass
(
value
)
export
const
n
:
typeof
normalizeClass
=
(
value
)
=>
normalizeClass
(
value
)
export
const
t
:
typeof
toDisplayString
=
(
val
)
=>
toDisplayString
(
val
)
export
const
t
:
typeof
toDisplayString
=
(
val
)
=>
toDisplayString
(
val
)
export
const
p
:
typeof
renderProps
=
(
props
)
=>
renderProps
(
props
)
export
const
p
:
typeof
renderProps
=
(
props
)
=>
renderProps
(
props
)
export
const
sr
:
typeof
setRef
=
(
ref
,
id
)
=>
setRef
(
ref
,
id
)
export
const
sr
:
typeof
setRef
=
(
ref
,
id
,
opts
)
=>
setRef
(
ref
,
id
,
opts
)
packages/uni-mp-vue/src/helpers/ref.ts
浏览文件 @
531e2e39
import
type
{
MPComponentInstance
}
from
'
@dcloudio/uni-mp-cor
e
'
import
{
ComponentInternalInstance
,
getCurrentInstance
,
Ref
}
from
'
vu
e
'
import
{
ComponentInternalInstance
,
getCurrentInstance
,
isRef
,
Ref
}
from
'
vue
'
// @ts-ignore
import
{
hasOwn
,
isFunction
,
isString
}
from
'
@vue/shared
'
import
{
getExposeProxy
}
from
'
vue
'
export
type
VNodeRef
=
type
VNodeRef
=
|
string
|
string
|
Ref
|
Ref
|
((
ref
:
object
|
null
,
refs
:
Record
<
string
,
any
>
)
=>
void
)
|
((
ref
:
object
|
null
,
refs
:
Record
<
string
,
any
>
)
=>
void
)
export
function
setRef
(
ref
:
VNodeRef
,
id
:
string
)
{
export
type
TemplateRef
=
{
const
{
i
:
string
// id
proxy
,
r
:
VNodeRef
ctx
:
{
$scope
},
k
?:
string
// setup ref key
setupState
,
f
?:
boolean
// refInFor marker
}
=
getCurrentInstance
()
!
as
ComponentInternalInstance
&
{
}
ctx
:
{
$scope
:
MPComponentInstance
}
setupState
:
Record
<
string
,
unknown
>
}
const
doSet
=
()
=>
{
let
mpInstance
=
$scope
.
selectAllComponents
(
'
.r
'
)
.
find
((
com
)
=>
com
&&
com
.
properties
.
uI
===
id
)
if
(
!
mpInstance
)
{
mpInstance
=
$scope
.
selectAllComponents
(
'
.r-i-f
'
)
.
find
((
com
)
=>
com
&&
com
.
properties
.
uI
===
id
)
}
if
(
!
mpInstance
)
{
return
}
// TODO 目前 $refs 实时从selectAllComponents中获取,不在 setRef 中对 $refs 做处理
const
refValue
=
mpInstance
.
$vm
if
(
isString
(
ref
))
{
if
(
hasOwn
(
setupState
,
ref
))
{
setupState
[
ref
]
=
refValue
}
}
else
if
(
isRef
(
ref
))
{
ref
.
value
=
refValue
}
else
if
(
isFunction
(
ref
))
{
ref
(
refValue
,
{})
}
}
if
(
$scope
.
_$setRef
)
{
export
function
setRef
(
$scope
.
_$setRef
(
doSet
)
ref
:
VNodeRef
,
}
else
{
id
:
string
,
proxy
!
.
$nextTick
(
doSet
)
opts
:
{
}
k
?:
string
f
?:
boolean
}
=
{}
):
void
{
const
{
$templateRefs
}
=
getCurrentInstance
()
!
as
ComponentInternalInstance
&
{
$templateRefs
:
TemplateRef
[]
}
$templateRefs
.
push
({
i
:
id
,
r
:
ref
,
k
:
opts
.
k
,
f
:
opts
.
f
})
}
}
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
531e2e39
...
@@ -91,6 +91,7 @@ function initBaseInstance(instance, options) {
...
@@ -91,6 +91,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
mp-weixin
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
531e2e39
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
...
@@ -219,6 +219,7 @@ function initBaseInstance(instance, options) {
// mp
// mp
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
mpType
=
options
.
mpType
;
// @deprecated
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpType
=
options
.
mpType
;
ctx
.
$mpPlatform
=
"
quickapp-webview
"
;
ctx
.
$scope
=
options
.
mpInstance
;
ctx
.
$scope
=
options
.
mpInstance
;
// TODO @deprecated
// TODO @deprecated
ctx
.
$mp
=
{};
ctx
.
$mp
=
{};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录