Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
9fa21db7
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,发现更多精彩内容 >>
提交
9fa21db7
编写于
10月 22, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(mp): reduce template size
上级
2f0369be
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
70 addition
and
67 deletion
+70
-67
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+2
-2
packages/uni-mp-alipay/src/runtime/createComponent.ts
packages/uni-mp-alipay/src/runtime/createComponent.ts
+1
-1
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+4
-4
packages/uni-mp-compiler/__tests__/component.spec.ts
packages/uni-mp-compiler/__tests__/component.spec.ts
+8
-8
packages/uni-mp-compiler/__tests__/ref.spec.ts
packages/uni-mp-compiler/__tests__/ref.spec.ts
+7
-7
packages/uni-mp-compiler/__tests__/vModel.spec.ts
packages/uni-mp-compiler/__tests__/vModel.spec.ts
+2
-2
packages/uni-mp-compiler/__tests__/vSlot.spec.ts
packages/uni-mp-compiler/__tests__/vSlot.spec.ts
+4
-4
packages/uni-mp-compiler/src/compile.ts
packages/uni-mp-compiler/src/compile.ts
+4
-4
packages/uni-mp-compiler/src/options.ts
packages/uni-mp-compiler/src/options.ts
+1
-1
packages/uni-mp-compiler/src/transform.ts
packages/uni-mp-compiler/src/transform.ts
+2
-2
packages/uni-mp-compiler/src/transforms/transformComponent.ts
...ages/uni-mp-compiler/src/transforms/transformComponent.ts
+8
-6
packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
...ges/uni-mp-compiler/src/transforms/transformIdentifier.ts
+2
-1
packages/uni-mp-core/src/runtime/componentProps.ts
packages/uni-mp-core/src/runtime/componentProps.ts
+1
-1
packages/uni-mp-core/src/runtime/util.ts
packages/uni-mp-core/src/runtime/util.ts
+2
-2
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+4
-4
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+4
-4
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+4
-4
packages/uni-mp-toutiao/src/runtime/componentLifetimes.ts
packages/uni-mp-toutiao/src/runtime/componentLifetimes.ts
+1
-1
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+4
-4
packages/uni-mp-weixin/src/runtime/lifetimes.ts
packages/uni-mp-weixin/src/runtime/lifetimes.ts
+1
-1
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+4
-4
未找到文件。
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
9fa21db7
...
...
@@ -623,7 +623,7 @@ function parsePropType(key, type, defaultValue) {
function
initDefaultProps
(
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
};
...
...
@@ -1357,7 +1357,7 @@ function initVm(mpInstance, createComponent) {
return
;
}
const
properties
=
mpInstance
.
props
;
initVueIds
(
properties
.
v
ueId
,
mpInstance
);
initVueIds
(
properties
.
v
I
,
mpInstance
);
const
relationOptions
=
{
vuePid
:
mpInstance
.
_$vuePid
,
mpInstance
,
...
...
packages/uni-mp-alipay/src/runtime/createComponent.ts
浏览文件 @
9fa21db7
...
...
@@ -53,7 +53,7 @@ function initVm(
return
}
const
properties
=
mpInstance
.
props
initVueIds
(
properties
.
v
ueId
,
mpInstance
as
any
)
initVueIds
(
properties
.
v
I
,
mpInstance
as
any
)
const
relationOptions
:
RelationOptions
=
{
vuePid
:
mpInstance
.
_$vuePid
,
mpInstance
,
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
9fa21db7
...
...
@@ -175,8 +175,8 @@ function initRefs(instance, mpInstance) {
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
const
$refs
=
{};
selectAllComponents
(
mpInstance
,
'
.v
ue-ref
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
ue-ref-in-for
'
);
selectAllComponents
(
mpInstance
,
'
.v
-r
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
-r-i-f
'
);
forComponents
.
forEach
((
component
)
=>
{
const
ref
=
component
.
dataset
.
ref
;
if
(
!
$refs
[
ref
])
{
...
...
@@ -662,7 +662,7 @@ function parsePropType(key, type, defaultValue) {
function
initDefaultProps
(
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
};
...
...
@@ -1234,7 +1234,7 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
return
{
attached
()
{
const
properties
=
this
.
properties
;
initVueIds
(
properties
.
v
ueId
,
this
);
initVueIds
(
properties
.
v
I
,
this
);
const
relationOptions
=
{
vuePid
:
this
.
_$vuePid
,
};
...
...
packages/uni-mp-compiler/__tests__/component.spec.ts
浏览文件 @
9fa21db7
...
...
@@ -5,7 +5,7 @@ describe('compiler: transform component', () => {
// test('basic', () => {
// assert(
// `<custom/>`,
// `<custom class="v
ue-ref" vue-id
="2a9ec0b0-0" bind:__l="__l"/>`,
// `<custom class="v
-r" v-i
="2a9ec0b0-0" bind:__l="__l"/>`,
// `(_ctx, _cache) => {
// return {}
// }`,
...
...
@@ -17,7 +17,7 @@ describe('compiler: transform component', () => {
test
(
'
component + component
'
,
()
=>
{
assert
(
`<custom><custom1/></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
ue-ref" vue-id="2a9ec0b0-0" bind:__l="__l"><custom1 class="vue-ref" vue-id
="2a9ec0b0-1,2a9ec0b0-0" bind:__l="__l"/></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
-r" v-i="2a9ec0b0-0" bind:__l="__l"><custom1 class="v-r" v-i
="2a9ec0b0-1,2a9ec0b0-0" bind:__l="__l"/></custom>`
,
`(_ctx, _cache) => {
return {}
}`
,
...
...
@@ -29,7 +29,7 @@ describe('compiler: transform component', () => {
test
(
'
component + component + component
'
,
()
=>
{
assert
(
`<custom><custom1><custom2/><custom2/></custom1></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
ue-ref" vue-id="2a9ec0b0-0" bind:__l="__l"><custom1 vue-slots="{{['default']}}" class="vue-ref" vue-id="2a9ec0b0-1,2a9ec0b0-0" bind:__l="__l"><custom2 class="vue-ref" vue-id="2a9ec0b0-2,2a9ec0b0-1" bind:__l="__l"/><custom2 class="vue-ref" vue-id
="2a9ec0b0-3,2a9ec0b0-1" bind:__l="__l"/></custom1></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
-r" v-i="2a9ec0b0-0" bind:__l="__l"><custom1 vue-slots="{{['default']}}" class="v-r" v-i="2a9ec0b0-1,2a9ec0b0-0" bind:__l="__l"><custom2 class="v-r" v-i="2a9ec0b0-2,2a9ec0b0-1" bind:__l="__l"/><custom2 class="v-r" v-i
="2a9ec0b0-3,2a9ec0b0-1" bind:__l="__l"/></custom1></custom>`
,
`(_ctx, _cache) => {
return {}
}`
,
...
...
@@ -41,7 +41,7 @@ describe('compiler: transform component', () => {
test
(
'
component with v-for
'
,
()
=>
{
assert
(
`<custom v-for="item in items"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="v
ue-ref-in-for" vue-id
="{{item.a}}" bind:__l="__l"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="v
-r-i-f" v-i
="{{item.a}}" bind:__l="__l"/>`
,
`(_ctx, _cache) => {
return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }) }
}`
,
...
...
@@ -51,7 +51,7 @@ describe('compiler: transform component', () => {
)
assert
(
`<custom v-for="(item,key,index) in items"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="v
ue-ref-in-for" vue-id
="{{item.a}}" bind:__l="__l"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="v
-r-i-f" v-i
="{{item.a}}" bind:__l="__l"/>`
,
`(_ctx, _cache) => {
return { a: _vFor(_ctx.items, (item, key, index) => { return { a: '2a9ec0b0-0' + '-' + index }; }) }
}`
,
...
...
@@ -63,7 +63,7 @@ describe('compiler: transform component', () => {
test
(
'
component + component with v-for
'
,
()
=>
{
assert
(
`<custom><custom1 v-for="item in items"/></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
ue-ref" vue-id="2a9ec0b0-0" bind:__l="__l"><custom1 wx:for="{{a}}" wx:for-item="item" class="vue-ref-in-for" vue-id
="{{item.a}}" bind:__l="__l"/></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
-r" v-i="2a9ec0b0-0" bind:__l="__l"><custom1 wx:for="{{a}}" wx:for-item="item" class="v-r-i-f" v-i
="{{item.a}}" bind:__l="__l"/></custom>`
,
`(_ctx, _cache) => {
return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-1' + '-' + i0 + ',' + '2a9ec0b0-0' }; }) }
}`
,
...
...
@@ -75,7 +75,7 @@ describe('compiler: transform component', () => {
test
(
'
component with v-for + component
'
,
()
=>
{
assert
(
`<custom v-for="item in items"><custom1/></custom>`
,
`<custom wx:for="{{a}}" wx:for-item="item" vue-slots="{{['default']}}" class="v
ue-ref-in-for" vue-id="{{item.b}}" bind:__l="__l"><custom1 class="vue-ref-in-for" vue-id
="{{item.a}}" bind:__l="__l"/></custom>`
,
`<custom wx:for="{{a}}" wx:for-item="item" vue-slots="{{['default']}}" class="v
-r-i-f" v-i="{{item.b}}" bind:__l="__l"><custom1 class="v-r-i-f" v-i
="{{item.a}}" bind:__l="__l"/></custom>`
,
`(_ctx, _cache) => {
return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-1' + '-' + i0 + ',' + ('2a9ec0b0-0' + '-' + i0), b: '2a9ec0b0-0' + '-' + i0 }; }) }
}`
,
...
...
@@ -87,7 +87,7 @@ describe('compiler: transform component', () => {
test
(
'
component with v-for + component with v-for
'
,
()
=>
{
assert
(
`<custom v-for="item in items"><custom1 v-for="item1 in item.items"/></custom>`
,
`<custom wx:for="{{a}}" wx:for-item="item" vue-slots="{{['default']}}" class="v
ue-ref-in-for" vue-id="{{item.b}}" bind:__l="__l"><custom1 wx:for="{{item.a}}" wx:for-item="item1" class="vue-ref-in-for" vue-id
="{{item1.a}}" bind:__l="__l"/></custom>`
,
`<custom wx:for="{{a}}" wx:for-item="item" vue-slots="{{['default']}}" class="v
-r-i-f" v-i="{{item.b}}" bind:__l="__l"><custom1 wx:for="{{item.a}}" wx:for-item="item1" class="v-r-i-f" v-i
="{{item1.a}}" bind:__l="__l"/></custom>`
,
`(_ctx, _cache) => {
return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: _vFor(item.items, (item1, k1, i1) => { return { a: '2a9ec0b0-1' + '-' + i0 + '-' + i1 + ',' + ('2a9ec0b0-0' + '-' + i0) }; }), b: '2a9ec0b0-0' + '-' + i0 }; }) }
}`
,
...
...
packages/uni-mp-compiler/__tests__/ref.spec.ts
浏览文件 @
9fa21db7
import
{
assert
}
from
'
./testUtils
'
describe
(
'
compiler: transform ref
'
,
()
=>
{
test
(
'
v
ue-ref
'
,
()
=>
{
test
(
'
v
-r
'
,
()
=>
{
assert
(
`<custom/>`
,
`<custom class="v
ue-ref" vue-id
="2a9ec0b0-0"/>`
,
`<custom class="v
-r" v-i
="2a9ec0b0-0"/>`
,
`(_ctx, _cache) => {
return {}
}`
)
assert
(
`<custom/><custom/><custom1/>`
,
`<custom class="v
ue-ref" vue-id="2a9ec0b0-0"/><custom class="vue-ref" vue-id="2a9ec0b0-1"/><custom1 class="vue-ref" vue-id
="2a9ec0b0-2"/>`
,
`<custom class="v
-r" v-i="2a9ec0b0-0"/><custom class="v-r" v-i="2a9ec0b0-1"/><custom1 class="v-r" v-i
="2a9ec0b0-2"/>`
,
`(_ctx, _cache) => {
return {}
}`
)
})
test
(
'
v
ue-ref-in-for
'
,
()
=>
{
test
(
'
v
-r-i-f
'
,
()
=>
{
assert
(
`<custom v-for="item in items"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="v
ue-ref-in-for" vue-id
="{{item.a}}"/>`
,
`<custom wx:for="{{a}}" wx:for-item="item" class="v
-r-i-f" v-i
="{{item.a}}"/>`
,
`(_ctx, _cache) => {
return { a: _vFor(_ctx.items, (item, k0, i0) => { return { a: '2a9ec0b0-0' + '-' + i0 }; }) }
}`
...
...
@@ -29,7 +29,7 @@ describe('compiler: transform ref', () => {
test
(
'
static ref
'
,
()
=>
{
assert
(
`<custom ref="custom"/>`
,
`<custom class="v
ue-ref" data-ref="custom" vue-id
="2a9ec0b0-0"/>`
,
`<custom class="v
-r" data-ref="custom" v-i
="2a9ec0b0-0"/>`
,
`(_ctx, _cache) => {
return {}
}`
...
...
@@ -38,7 +38,7 @@ describe('compiler: transform ref', () => {
test
(
'
dynamic ref
'
,
()
=>
{
assert
(
`<custom :ref="custom"/>`
,
`<custom class="v
ue-ref" data-ref="{{a}}" vue-id
="2a9ec0b0-0"/>`
,
`<custom class="v
-r" data-ref="{{a}}" v-i
="2a9ec0b0-0"/>`
,
`(_ctx, _cache) => {
return { a: _ctx.custom }
}`
...
...
packages/uni-mp-compiler/__tests__/vModel.spec.ts
浏览文件 @
9fa21db7
...
...
@@ -4,7 +4,7 @@ describe('compiler: transform v-model', () => {
test
(
`component v-model`
,
()
=>
{
assert
(
`<Comp v-model="model" />`
,
`<comp class="v
ue-ref" vue-id
="2a9ec0b0-0" modelValue="{{a}}" bindupdateModelValue="{{b}}"/>`
,
`<comp class="v
-r" v-i
="2a9ec0b0-0" modelValue="{{a}}" bindupdateModelValue="{{b}}"/>`
,
`(_ctx, _cache) => {
return { a: _ctx.model, b: _vOn($event => _ctx.model = $event) }
}`
...
...
@@ -13,7 +13,7 @@ describe('compiler: transform v-model', () => {
test
(
`component v-model with cache`
,
()
=>
{
assert
(
`<Comp v-model="model" />`
,
`<comp class="v
ue-ref" vue-id
="2a9ec0b0-0" modelValue="{{a}}" bindupdateModelValue="{{b}}"/>`
,
`<comp class="v
-r" v-i
="2a9ec0b0-0" modelValue="{{a}}" bindupdateModelValue="{{b}}"/>`
,
`(_ctx, _cache) => {
return { a: _ctx.model, b: _vOn($event => _ctx.model = $event) }
}`
,
...
...
packages/uni-mp-compiler/__tests__/vSlot.spec.ts
浏览文件 @
9fa21db7
...
...
@@ -4,14 +4,14 @@ describe('compiler: transform v-slot', () => {
test
(
'
default slot
'
,
()
=>
{
assert
(
`<custom><template v-slot/></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
ue-ref" vue-id
="2a9ec0b0-0"><view /></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
-r" v-i
="2a9ec0b0-0"><view /></custom>`
,
`(_ctx, _cache) => {
return {}
}`
)
assert
(
`<custom>test</custom>`
,
`<custom vue-slots="{{['default']}}" class="v
ue-ref" vue-id
="2a9ec0b0-0">test</custom>`
,
`<custom vue-slots="{{['default']}}" class="v
-r" v-i
="2a9ec0b0-0">test</custom>`
,
`(_ctx, _cache) => {
return {}
}`
...
...
@@ -20,7 +20,7 @@ describe('compiler: transform v-slot', () => {
test
(
'
named slots
'
,
()
=>
{
assert
(
`<custom><template v-slot:header/><template v-slot:default/><template v-slot:footer/></custom>`
,
`<custom vue-slots="{{['header','default','footer']}}" class="v
ue-ref" vue-id
="2a9ec0b0-0"><view slot="header"/><view slot="default"/><view slot="footer"/></custom>`
,
`<custom vue-slots="{{['header','default','footer']}}" class="v
-r" v-i
="2a9ec0b0-0"><view slot="header"/><view slot="default"/><view slot="footer"/></custom>`
,
`(_ctx, _cache) => {
return {}
}`
...
...
@@ -30,7 +30,7 @@ describe('compiler: transform v-slot', () => {
test
(
'
scoped slots
'
,
()
=>
{
assert
(
`<custom><template v-slot:default="slotProps"><view>{{ slotProps.item }}</view></template></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
ue-ref" vue-id
="2a9ec0b0-0"><view slot="default"><view>{{a}}</view></view></custom>`
,
`<custom vue-slots="{{['default']}}" class="v
-r" v-i
="2a9ec0b0-0"><view slot="default"><view>{{a}}</view></view></custom>`
,
`(_ctx, _cache) => {
return { a: _toDisplayString(_ctx.slotProps.item), b: slotProps }
}`
...
...
packages/uni-mp-compiler/src/compile.ts
浏览文件 @
9fa21db7
...
...
@@ -48,7 +48,7 @@ export function baseCompile(template: string, options: CompilerOptions = {}) {
skipTransformIdentifier
:
options
.
skipTransformIdentifier
===
true
,
})
options
.
vueId
=
genVue
Id
(
options
)
options
.
hashId
=
genHash
Id
(
options
)
if
(
options
.
filename
)
{
if
(
options
.
filters
&&
options
.
miniProgram
?.
filter
)
{
...
...
@@ -94,9 +94,9 @@ export function baseCompile(template: string, options: CompilerOptions = {}) {
return
result
}
function
gen
Vue
Id
(
options
:
CompilerOptions
)
{
if
(
options
.
vue
Id
)
{
return
options
.
vue
Id
function
gen
Hash
Id
(
options
:
CompilerOptions
)
{
if
(
options
.
hash
Id
)
{
return
options
.
hash
Id
}
if
(
options
.
scopeId
)
{
return
options
.
scopeId
.
replace
(
'
data-v-
'
,
''
)
...
...
packages/uni-mp-compiler/src/options.ts
浏览文件 @
9fa21db7
...
...
@@ -46,7 +46,7 @@ interface SharedTransformCodegenOptions {
export
interface
TransformOptions
extends
SharedTransformCodegenOptions
,
ErrorHandlingOptions
{
vue
Id
?:
string
|
null
hash
Id
?:
string
|
null
scopeId
?:
string
|
null
filters
?:
string
[]
cacheHandlers
?:
boolean
...
...
packages/uni-mp-compiler/src/transform.ts
浏览文件 @
9fa21db7
...
...
@@ -216,7 +216,7 @@ export function createTransformContext(
filename
=
''
,
isTS
=
false
,
inline
=
false
,
vue
Id
=
null
,
hash
Id
=
null
,
scopeId
=
null
,
filters
=
[],
bindingMetadata
=
EMPTY_OBJ
,
...
...
@@ -275,7 +275,7 @@ export function createTransformContext(
selfName
:
nameMatch
&&
capitalize
(
camelize
(
nameMatch
[
1
])),
isTS
,
inline
,
vue
Id
,
hash
Id
,
scopeId
,
filters
,
bindingMetadata
,
...
...
packages/uni-mp-compiler/src/transforms/transformComponent.ts
浏览文件 @
9fa21db7
...
...
@@ -28,11 +28,11 @@ export const transformComponent: NodeTransform = (node, context) => {
}
function
addVueId
(
node
:
ComponentNode
,
context
:
TransformContext
)
{
let
{
vue
Id
,
scopes
,
currentScope
,
currentVueId
}
=
context
if
(
!
vue
Id
)
{
let
{
hash
Id
,
scopes
,
currentScope
,
currentVueId
}
=
context
if
(
!
hash
Id
)
{
return
}
vueId
=
vue
Id
+
'
-
'
+
scopes
.
vueId
++
let
vueId
=
hash
Id
+
'
-
'
+
scopes
.
vueId
++
const
indexs
:
string
[]
=
[]
while
(
currentScope
)
{
if
(
isVForScope
(
currentScope
))
{
...
...
@@ -60,14 +60,16 @@ function addVueId(node: ComponentNode, context: TransformContext) {
}
}
if
(
value
.
includes
(
'
+
'
))
{
return
node
.
props
.
push
(
createBindDirectiveNode
(
'
v
ue-id
'
,
value
))
return
node
.
props
.
push
(
createBindDirectiveNode
(
'
v
-i
'
,
value
))
}
return
node
.
props
.
push
(
createAttributeNode
(
'
v
ue-id
'
,
value
))
return
node
.
props
.
push
(
createAttributeNode
(
'
v
-i
'
,
value
))
}
function
addVueRef
(
node
:
ComponentNode
,
context
:
TransformContext
)
{
return
addStaticClass
(
node
,
context
.
scopes
.
vFor
?
'
vue-ref-in-for
'
:
'
vue-ref
'
// vue-ref-in-for
// vue-ref
context
.
scopes
.
vFor
?
'
v-r-i-f
'
:
'
v-r
'
)
}
packages/uni-mp-compiler/src/transforms/transformIdentifier.ts
浏览文件 @
9fa21db7
...
...
@@ -82,7 +82,8 @@ export const transformIdentifier: NodeTransform = (node, context) => {
}
}
// const builtInProps = ['vue-id']
// vue-id
// const builtInProps = ['v-i']
function
isBuiltIn
(
_dir
:
DirectiveNode
)
{
return
false
...
...
packages/uni-mp-core/src/runtime/componentProps.ts
浏览文件 @
9fa21db7
...
...
@@ -37,7 +37,7 @@ function parsePropType(key: string, type: unknown, defaultValue: unknown) {
function
initDefaultProps
(
isBehavior
:
boolean
=
false
)
{
const
properties
:
Component
.
PropertyOption
=
{}
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
}
...
...
packages/uni-mp-core/src/runtime/util.ts
浏览文件 @
9fa21db7
...
...
@@ -88,8 +88,8 @@ export function initRefs(
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
const
$refs
:
Record
<
string
,
any
>
=
{}
selectAllComponents
(
mpInstance
,
'
.v
ue-ref
'
,
$refs
)
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
ue-ref-in-for
'
)
selectAllComponents
(
mpInstance
,
'
.v
-r
'
,
$refs
)
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
-r-i-f
'
)
forComponents
.
forEach
((
component
)
=>
{
const
ref
=
component
.
dataset
.
ref
if
(
!
$refs
[
ref
])
{
...
...
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
9fa21db7
...
...
@@ -175,8 +175,8 @@ function initRefs(instance, mpInstance) {
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
const
$refs
=
{};
selectAllComponents
(
mpInstance
,
'
.v
ue-ref
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
ue-ref-in-for
'
);
selectAllComponents
(
mpInstance
,
'
.v
-r
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
-r-i-f
'
);
forComponents
.
forEach
((
component
)
=>
{
const
ref
=
component
.
dataset
.
ref
;
if
(
!
$refs
[
ref
])
{
...
...
@@ -651,7 +651,7 @@ function parsePropType(key, type, defaultValue) {
function
initDefaultProps
(
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
};
...
...
@@ -1161,7 +1161,7 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
return
{
attached
()
{
const
properties
=
this
.
properties
;
initVueIds
(
properties
.
v
ueId
,
this
);
initVueIds
(
properties
.
v
I
,
this
);
const
relationOptions
=
{
vuePid
:
this
.
_$vuePid
,
};
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
9fa21db7
...
...
@@ -175,8 +175,8 @@ function initRefs(instance, mpInstance) {
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
const
$refs
=
{};
selectAllComponents
(
mpInstance
,
'
.v
ue-ref
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
ue-ref-in-for
'
);
selectAllComponents
(
mpInstance
,
'
.v
-r
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
-r-i-f
'
);
forComponents
.
forEach
((
component
)
=>
{
const
ref
=
component
.
dataset
.
ref
;
if
(
!
$refs
[
ref
])
{
...
...
@@ -651,7 +651,7 @@ function parsePropType(key, type, defaultValue) {
function
initDefaultProps
(
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
};
...
...
@@ -1161,7 +1161,7 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
return
{
attached
()
{
const
properties
=
this
.
properties
;
initVueIds
(
properties
.
v
ueId
,
this
);
initVueIds
(
properties
.
v
I
,
this
);
const
relationOptions
=
{
vuePid
:
this
.
_$vuePid
,
};
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
9fa21db7
...
...
@@ -175,8 +175,8 @@ function initRefs(instance, mpInstance) {
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
const
$refs
=
{};
selectAllComponents
(
mpInstance
,
'
.v
ue-ref
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
ue-ref-in-for
'
);
selectAllComponents
(
mpInstance
,
'
.v
-r
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
-r-i-f
'
);
forComponents
.
forEach
((
component
)
=>
{
const
ref
=
component
.
dataset
.
ref
;
if
(
!
$refs
[
ref
])
{
...
...
@@ -654,7 +654,7 @@ function parsePropType(key, type, defaultValue) {
function
initDefaultProps
(
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
};
...
...
@@ -1255,7 +1255,7 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
return
{
attached
()
{
const
properties
=
this
.
properties
;
initVueIds
(
properties
.
v
ueId
,
this
);
initVueIds
(
properties
.
v
I
,
this
);
const
relationOptions
=
{
vuePid
:
this
.
_$vuePid
,
};
...
...
packages/uni-mp-toutiao/src/runtime/componentLifetimes.ts
浏览文件 @
9fa21db7
...
...
@@ -25,7 +25,7 @@ export function initLifetimes({
return
{
attached
(
this
:
MPComponentInstance
)
{
const
properties
=
this
.
properties
initVueIds
(
properties
.
v
ueId
,
this
)
initVueIds
(
properties
.
v
I
,
this
)
const
relationOptions
:
RelationOptions
=
{
vuePid
:
this
.
_$vuePid
,
}
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
9fa21db7
...
...
@@ -121,8 +121,8 @@ function initRefs(instance, mpInstance) {
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
const
$refs
=
{};
selectAllComponents
(
mpInstance
,
'
.v
ue-ref
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
ue-ref-in-for
'
);
selectAllComponents
(
mpInstance
,
'
.v
-r
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
-r-i-f
'
);
forComponents
.
forEach
((
component
)
=>
{
const
ref
=
component
.
dataset
.
ref
;
if
(
!
$refs
[
ref
])
{
...
...
@@ -597,7 +597,7 @@ function parsePropType(key, type, defaultValue) {
function
initDefaultProps
(
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
};
...
...
@@ -1107,7 +1107,7 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
return
{
attached
()
{
const
properties
=
this
.
properties
;
initVueIds
(
properties
.
v
ueId
,
this
);
initVueIds
(
properties
.
v
I
,
this
);
const
relationOptions
=
{
vuePid
:
this
.
_$vuePid
,
};
...
...
packages/uni-mp-weixin/src/runtime/lifetimes.ts
浏览文件 @
9fa21db7
...
...
@@ -26,7 +26,7 @@ export function initLifetimes({
return
{
attached
(
this
:
MPComponentInstance
)
{
const
properties
=
this
.
properties
initVueIds
(
properties
.
v
ueId
,
this
)
initVueIds
(
properties
.
v
I
,
this
)
const
relationOptions
:
RelationOptions
=
{
vuePid
:
this
.
_$vuePid
,
}
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
9fa21db7
...
...
@@ -175,8 +175,8 @@ function initRefs(instance, mpInstance) {
Object
.
defineProperty
(
instance
,
'
refs
'
,
{
get
()
{
const
$refs
=
{};
selectAllComponents
(
mpInstance
,
'
.v
ue-ref
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
ue-ref-in-for
'
);
selectAllComponents
(
mpInstance
,
'
.v
-r
'
,
$refs
);
const
forComponents
=
mpInstance
.
selectAllComponents
(
'
.v
-r-i-f
'
);
forComponents
.
forEach
((
component
)
=>
{
const
ref
=
component
.
dataset
.
ref
;
if
(
!
$refs
[
ref
])
{
...
...
@@ -582,7 +582,7 @@ function parsePropType(key, type, defaultValue) {
function
initDefaultProps
(
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
properties
.
v
ueId
=
{
properties
.
v
I
=
{
type
:
String
,
value
:
''
,
};
...
...
@@ -1177,7 +1177,7 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
return
{
attached
()
{
const
properties
=
this
.
properties
;
initVueIds
(
properties
.
v
ueId
,
this
);
initVueIds
(
properties
.
v
I
,
this
);
const
relationOptions
=
{
vuePid
:
this
.
_$vuePid
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录