Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ChenYFan_OHHH
uni-app
提交
9ba90c8b
U
uni-app
项目概览
ChenYFan_OHHH
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9ba90c8b
编写于
10月 17, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(mp-weixin):
uni://form-field
(question/155373)
上级
ef6c3f24
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
347 addition
and
48 deletion
+347
-48
packages/shims-vue-runtime.d.ts
packages/shims-vue-runtime.d.ts
+1
-0
packages/uni-mp-alipay/dist/uni.mp.esm.js
packages/uni-mp-alipay/dist/uni.mp.esm.js
+17
-4
packages/uni-mp-baidu/dist/uni.mp.esm.js
packages/uni-mp-baidu/dist/uni.mp.esm.js
+36
-4
packages/uni-mp-core/src/index.ts
packages/uni-mp-core/src/index.ts
+1
-1
packages/uni-mp-core/src/runtime/componentOptions.ts
packages/uni-mp-core/src/runtime/componentOptions.ts
+2
-2
packages/uni-mp-core/src/runtime/componentProps.ts
packages/uni-mp-core/src/runtime/componentProps.ts
+45
-3
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
+36
-4
packages/uni-mp-lark/dist/uni.mp.esm.js
packages/uni-mp-lark/dist/uni.mp.esm.js
+38
-5
packages/uni-mp-qq/dist/uni.mp.esm.js
packages/uni-mp-qq/dist/uni.mp.esm.js
+36
-4
packages/uni-mp-toutiao/dist/uni.mp.esm.js
packages/uni-mp-toutiao/dist/uni.mp.esm.js
+38
-5
packages/uni-mp-toutiao/src/runtime/componentLifetimes.ts
packages/uni-mp-toutiao/src/runtime/componentLifetimes.ts
+9
-2
packages/uni-mp-weixin/dist/uni.mp.esm.js
packages/uni-mp-weixin/dist/uni.mp.esm.js
+36
-4
packages/uni-mp-weixin/src/runtime/lifetimes.ts
packages/uni-mp-weixin/src/runtime/lifetimes.ts
+5
-0
packages/uni-quickapp-webview/dist/uni.mp.esm.js
packages/uni-quickapp-webview/dist/uni.mp.esm.js
+38
-5
packages/uni-stat/lib/uni.plugin.js
packages/uni-stat/lib/uni.plugin.js
+1
-1
packages/uni-stat/src/plugin/index.ts
packages/uni-stat/src/plugin/index.ts
+8
-4
未找到文件。
packages/shims-vue-runtime.d.ts
浏览文件 @
9ba90c8b
...
...
@@ -5,6 +5,7 @@ declare module '@vue/runtime-core' {
route
:
string
$scope
:
{
$getAppWebview
?:
()
=>
PlusWebviewWebviewObject
setData
(
data
:
Record
<
string
,
unknown
>
,
callback
?:
()
=>
void
):
void
}
// 目前 H5,APP 平台 getCurrentPages 中获取的 page 对象调整为 vm 对象
$getAppWebview
?:
()
=>
PlusWebviewWebviewObject
...
...
packages/uni-mp-alipay/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -339,7 +339,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -365,6 +365,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
my://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -392,7 +405,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
function
findPropsData
(
properties
,
isPage
)
{
return
((
isPage
...
...
@@ -453,14 +466,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
packages/uni-mp-baidu/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -437,7 +437,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -463,6 +463,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
swan://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -478,7 +491,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
function
parsePropType
(
type
,
defaultValue
)
{
...
...
@@ -557,6 +570,22 @@ function findPagePropsData(properties) {
});
}
return
propsData
;
}
function
initFormField
(
vm
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
;
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
))
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
vm
.
name
,
value
:
vm
.
modelValue
,
});
},
{
immediate
:
true
,
});
}
}
function
initData
(
_
)
{
...
...
@@ -630,14 +659,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
@@ -888,6 +917,9 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
initComponentInstance
(
instance
,
options
);
},
});
if
(
!
isMiniProgramPage
)
{
initFormField
(
this
.
$vm
);
}
},
ready
()
{
// 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
...
...
packages/uni-mp-core/src/index.ts
浏览文件 @
9ba90c8b
...
...
@@ -23,7 +23,7 @@ export {
initBehaviors
,
updateComponentProps
,
}
from
'
./runtime/componentOptions
'
export
{
initProps
}
from
'
./runtime/componentProps
'
export
{
initProps
,
initFormField
}
from
'
./runtime/componentProps
'
export
{
initHooks
,
initUnknownHooks
,
...
...
packages/uni-mp-core/src/runtime/componentOptions.ts
浏览文件 @
9ba90c8b
...
...
@@ -111,13 +111,13 @@ export function initBehaviors(vueOptions: ComponentOptions): string[] {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
)
vueProps
.
push
(
'
v
alue
'
)
vueProps
.
push
(
'
modelV
alue
'
)
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
}
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
}
...
...
packages/uni-mp-core/src/runtime/componentProps.ts
浏览文件 @
9ba90c8b
import
{
ComponentPropsOptions
}
from
'
@vue/runtime-core
'
import
{
ComponentPropsOptions
,
ComponentPublicInstance
,
}
from
'
@vue/runtime-core
'
import
{
extend
,
isArray
,
isFunction
,
isPlainObject
}
from
'
@vue/shared
'
import
type
{
MPComponentOptions
,
MPComponentInstance
}
from
'
./component
'
// @ts-ignore
...
...
@@ -24,7 +27,10 @@ const builtInProps = [
'
uS
'
,
]
function
initDefaultProps
(
isBehavior
:
boolean
=
false
)
{
function
initDefaultProps
(
options
:
MPComponentOptions
,
isBehavior
:
boolean
=
false
)
{
const
properties
:
Component
.
PropertyOption
=
{}
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -50,6 +56,19 @@ function initDefaultProps(isBehavior: boolean = false) {
},
}
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
__GLOBAL__://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
}
properties
.
value
=
{
type
:
null
,
value
:
''
,
}
}
}
return
properties
}
...
...
@@ -81,7 +100,7 @@ export function initProps(mpComponentOptions: MPComponentOptions) {
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
)
)
}
...
...
@@ -176,3 +195,26 @@ function findPagePropsData(properties: Record<string, any>) {
}
return
propsData
}
export
function
initFormField
(
vm
:
ComponentPublicInstance
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
)
)
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
(
vm
as
any
).
name
,
value
:
(
vm
as
any
).
modelValue
,
})
},
{
immediate
:
true
,
}
)
}
}
packages/uni-mp-kuaishou/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -437,7 +437,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -463,6 +463,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
ks://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -478,7 +491,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
function
parsePropType
(
type
,
defaultValue
)
{
...
...
@@ -546,6 +559,22 @@ function findPagePropsData(properties) {
});
}
return
propsData
;
}
function
initFormField
(
vm
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
;
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
))
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
vm
.
name
,
value
:
vm
.
modelValue
,
});
},
{
immediate
:
true
,
});
}
}
function
initData
(
_
)
{
...
...
@@ -615,14 +644,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
@@ -854,6 +883,9 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
initComponentInstance
(
instance
,
options
);
},
});
if
(
!
isMiniProgramPage
)
{
initFormField
(
this
.
$vm
);
}
},
ready
()
{
// 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
...
...
packages/uni-mp-lark/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -400,7 +400,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -426,6 +426,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
tt://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -441,7 +454,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
function
parsePropType
(
type
,
defaultValue
)
{
...
...
@@ -509,6 +522,22 @@ function findPagePropsData(properties) {
});
}
return
propsData
;
}
function
initFormField
(
vm
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
;
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
))
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
vm
.
name
,
value
:
vm
.
modelValue
,
});
},
{
immediate
:
true
,
});
}
}
function
initData
(
_
)
{
...
...
@@ -578,14 +607,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
@@ -844,9 +873,10 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
if
(
mpType
===
'
page
'
&&
!
mpInstance
.
route
&&
mpInstance
.
__route__
)
{
mpInstance
.
route
=
mpInstance
.
__route__
;
}
const
props
=
findPropsData
(
properties
,
mpType
===
'
page
'
);
this
.
$vm
=
$createComponent
({
type
:
vueOptions
,
props
:
findPropsData
(
properties
,
mpType
===
'
page
'
)
,
props
,
},
{
mpType
,
mpInstance
,
...
...
@@ -858,6 +888,9 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
initComponentInstance
(
instance
,
options
);
},
});
if
(
mpType
===
'
component
'
)
{
initFormField
(
this
.
$vm
);
}
// 处理父子关系
initRelation
(
this
,
relationOptions
);
}
...
...
packages/uni-mp-qq/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -386,7 +386,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -412,6 +412,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
qq://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -427,7 +440,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
function
parsePropType
(
type
,
defaultValue
)
{
...
...
@@ -495,6 +508,22 @@ function findPagePropsData(properties) {
});
}
return
propsData
;
}
function
initFormField
(
vm
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
;
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
))
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
vm
.
name
,
value
:
vm
.
modelValue
,
});
},
{
immediate
:
true
,
});
}
}
function
initData
(
_
)
{
...
...
@@ -567,14 +596,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
@@ -767,6 +796,9 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
initComponentInstance
(
instance
,
options
);
},
});
if
(
!
isMiniProgramPage
)
{
initFormField
(
this
.
$vm
);
}
},
ready
()
{
// 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
...
...
packages/uni-mp-toutiao/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -400,7 +400,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -426,6 +426,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
tt://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -441,7 +454,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
function
parsePropType
(
type
,
defaultValue
)
{
...
...
@@ -509,6 +522,22 @@ function findPagePropsData(properties) {
});
}
return
propsData
;
}
function
initFormField
(
vm
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
;
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
))
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
vm
.
name
,
value
:
vm
.
modelValue
,
});
},
{
immediate
:
true
,
});
}
}
function
initData
(
_
)
{
...
...
@@ -582,14 +611,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
@@ -853,9 +882,10 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
if
(
mpType
===
'
page
'
&&
!
mpInstance
.
route
&&
mpInstance
.
__route__
)
{
mpInstance
.
route
=
mpInstance
.
__route__
;
}
const
props
=
findPropsData
(
properties
,
mpType
===
'
page
'
);
this
.
$vm
=
$createComponent
({
type
:
vueOptions
,
props
:
findPropsData
(
properties
,
mpType
===
'
page
'
)
,
props
,
},
{
mpType
,
mpInstance
,
...
...
@@ -867,6 +897,9 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
initComponentInstance
(
instance
,
options
);
},
});
if
(
mpType
===
'
component
'
)
{
initFormField
(
this
.
$vm
);
}
// 处理父子关系
initRelation
(
this
,
relationOptions
);
}
...
...
packages/uni-mp-toutiao/src/runtime/componentLifetimes.ts
浏览文件 @
9ba90c8b
import
{
ComponentInternalInstance
,
ComponentPublicInstance
}
from
'
vue
'
import
type
{
ComponentInternalInstance
,
ComponentPublicInstance
}
from
'
vue
'
// @ts-ignore
import
{
pruneComponentPropsCache
}
from
'
vue
'
import
{
...
...
@@ -8,6 +8,7 @@ import {
CreateLifetimesOptions
,
initSetRef
,
findPropsData
,
initFormField
,
}
from
'
@dcloudio/uni-mp-core
'
import
{
...
...
@@ -47,10 +48,12 @@ export function initLifetimes({
mpInstance
.
route
=
mpInstance
.
__route__
}
const
props
=
findPropsData
(
properties
,
mpType
===
'
page
'
)
this
.
$vm
=
$createComponent
(
{
type
:
vueOptions
,
props
:
findPropsData
(
properties
,
mpType
===
'
page
'
)
,
props
,
},
{
mpType
,
...
...
@@ -68,6 +71,10 @@ export function initLifetimes({
}
)
as
ComponentPublicInstance
if
(
mpType
===
'
component
'
)
{
initFormField
(
this
.
$vm
)
}
// 处理父子关系
initRelation
(
this
,
relationOptions
)
}
...
...
packages/uni-mp-weixin/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -386,7 +386,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -412,6 +412,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
wx://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -439,7 +452,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
function
parsePropType
(
type
,
defaultValue
)
{
...
...
@@ -507,6 +520,22 @@ function findPagePropsData(properties) {
});
}
return
propsData
;
}
function
initFormField
(
vm
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
;
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
))
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
vm
.
name
,
value
:
vm
.
modelValue
,
});
},
{
immediate
:
true
,
});
}
}
function
initData
(
_
)
{
...
...
@@ -579,14 +608,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
@@ -779,6 +808,9 @@ function initLifetimes({ mocks, isPage, initRelation, vueOptions, }) {
initComponentInstance
(
instance
,
options
);
},
});
if
(
!
isMiniProgramPage
)
{
initFormField
(
this
.
$vm
);
}
},
ready
()
{
// 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
...
...
packages/uni-mp-weixin/src/runtime/lifetimes.ts
浏览文件 @
9ba90c8b
...
...
@@ -8,6 +8,7 @@ import {
CreateComponentOptions
,
CreateLifetimesOptions
,
findPropsData
,
initFormField
,
}
from
'
@dcloudio/uni-mp-core
'
import
{
...
...
@@ -55,6 +56,7 @@ export function initLifetimes({
propsData
=
this
.
options
as
Record
<
string
,
any
>
}
}
this
.
$vm
=
$createComponent
(
{
type
:
vueOptions
,
...
...
@@ -75,6 +77,9 @@ export function initLifetimes({
},
}
)
as
ComponentPublicInstance
if
(
!
isMiniProgramPage
)
{
initFormField
(
this
.
$vm
)
}
},
ready
(
this
:
MPComponentInstance
)
{
// 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
...
...
packages/uni-quickapp-webview/dist/uni.mp.esm.js
浏览文件 @
9ba90c8b
...
...
@@ -378,7 +378,7 @@ const builtInProps = [
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
'
uS
'
,
];
function
initDefaultProps
(
isBehavior
=
false
)
{
function
initDefaultProps
(
options
,
isBehavior
=
false
)
{
const
properties
=
{};
if
(
!
isBehavior
)
{
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
...
...
@@ -404,6 +404,19 @@ function initDefaultProps(isBehavior = false) {
},
};
}
if
(
options
.
behaviors
)
{
// wx://form-field
if
(
options
.
behaviors
.
includes
(
'
qa://form-field
'
))
{
properties
.
name
=
{
type
:
null
,
value
:
''
,
};
properties
.
value
=
{
type
:
null
,
value
:
''
,
};
}
}
return
properties
;
}
function
initVirtualHostProps
(
options
)
{
...
...
@@ -419,7 +432,7 @@ function initProps(mpComponentOptions) {
if
(
!
mpComponentOptions
.
properties
)
{
mpComponentOptions
.
properties
=
{};
}
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(),
initVirtualHostProps
(
mpComponentOptions
.
options
));
extend
(
mpComponentOptions
.
properties
,
initDefaultProps
(
mpComponentOptions
),
initVirtualHostProps
(
mpComponentOptions
.
options
));
}
const
PROP_TYPES
=
[
String
,
Number
,
Boolean
,
Object
,
Array
,
null
];
function
parsePropType
(
type
,
defaultValue
)
{
...
...
@@ -487,6 +500,22 @@ function findPagePropsData(properties) {
});
}
return
propsData
;
}
function
initFormField
(
vm
)
{
// 同步 form-field 的 name,value 值
const
vueOptions
=
vm
.
$options
;
if
(
isArray
(
vueOptions
.
behaviors
)
&&
vueOptions
.
behaviors
.
includes
(
'
uni://form-field
'
))
{
vm
.
$watch
(
'
modelValue
'
,
()
=>
{
vm
.
$scope
&&
vm
.
$scope
.
setData
({
name
:
vm
.
name
,
value
:
vm
.
modelValue
,
});
},
{
immediate
:
true
,
});
}
}
function
initData
(
_
)
{
...
...
@@ -556,14 +585,14 @@ function initBehaviors(vueOptions) {
if
(
behavior
===
'
uni://form-field
'
)
{
if
(
isArray
(
vueProps
))
{
vueProps
.
push
(
'
name
'
);
vueProps
.
push
(
'
v
alue
'
);
vueProps
.
push
(
'
modelV
alue
'
);
}
else
{
vueProps
.
name
=
{
type
:
String
,
default
:
''
,
};
vueProps
.
v
alue
=
{
vueProps
.
modelV
alue
=
{
type
:
[
String
,
Number
,
Boolean
,
Array
,
Object
,
Date
],
default
:
''
,
};
...
...
@@ -818,9 +847,10 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
if
(
mpType
===
'
page
'
&&
!
mpInstance
.
route
&&
mpInstance
.
__route__
)
{
mpInstance
.
route
=
mpInstance
.
__route__
;
}
const
props
=
findPropsData
(
properties
,
mpType
===
'
page
'
);
this
.
$vm
=
$createComponent
({
type
:
vueOptions
,
props
:
findPropsData
(
properties
,
mpType
===
'
page
'
)
,
props
,
},
{
mpType
,
mpInstance
,
...
...
@@ -832,6 +862,9 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
initComponentInstance
(
instance
,
options
);
},
});
if
(
mpType
===
'
component
'
)
{
initFormField
(
this
.
$vm
);
}
// 处理父子关系
initRelation
(
this
,
relationOptions
);
}
...
...
packages/uni-stat/lib/uni.plugin.js
浏览文件 @
9ba90c8b
...
...
@@ -81,7 +81,7 @@ var index = () => [
else
{
uniStatLog
(
`已开启 uni统计
${
statVersion
}
.0 版本`
);
if
(
statVersion
===
'
2
'
)
{
uniStatDeviceLog
(
'
1
【重要】因 HBuilderX 3.4.9 版本起,uni统计2.0 调整了安卓端 deviceId 获取方式,导致 uni统计2.0 App-Android平台部分统计数据不准确。如使用了HBuilderX 3.4.9 - 3.6.4版本且开通了uni统计2.0的应用,需要使用HBuilderX3.6.7及以上版本重新发布应用并升级 uniAdmin 云函数解决,详见:https://ask.dcloud.net.cn/article/40097
'
);
uniStatDeviceLog
(
'
【重要】因 HBuilderX 3.4.9 版本起,uni统计2.0 调整了安卓端 deviceId 获取方式,导致 uni统计2.0 App-Android平台部分统计数据不准确。如使用了HBuilderX 3.4.9 - 3.6.4版本且开通了uni统计2.0的应用,需要使用HBuilderX3.6.7及以上版本重新发布应用并升级 uniAdmin 云函数解决,详见:https://ask.dcloud.net.cn/article/40097
'
);
}
}
}
...
...
packages/uni-stat/src/plugin/index.ts
浏览文件 @
9ba90c8b
...
...
@@ -77,8 +77,10 @@ export default () => [
uniStatLog
(
M
[
'
stat.warn.version
'
])
}
else
{
uniStatLog
(
`已开启 uni统计
${
statVersion
}
.0 版本`
)
if
(
statVersion
===
'
2
'
)
{
uniStatDeviceLog
(
'
【重要】因 HBuilderX 3.4.9 版本起,uni统计2.0 调整了安卓端 deviceId 获取方式,导致 uni统计2.0 App-Android平台部分统计数据不准确。如使用了HBuilderX 3.4.9 - 3.6.4版本且开通了uni统计2.0的应用,需要使用HBuilderX3.6.7及以上版本重新发布应用并升级 uniAdmin 云函数解决,详见:https://ask.dcloud.net.cn/article/40097
'
)
if
(
statVersion
===
'
2
'
)
{
uniStatDeviceLog
(
'
【重要】因 HBuilderX 3.4.9 版本起,uni统计2.0 调整了安卓端 deviceId 获取方式,导致 uni统计2.0 App-Android平台部分统计数据不准确。如使用了HBuilderX 3.4.9 - 3.6.4版本且开通了uni统计2.0的应用,需要使用HBuilderX3.6.7及以上版本重新发布应用并升级 uniAdmin 云函数解决,详见:https://ask.dcloud.net.cn/article/40097
'
)
}
}
}
...
...
@@ -89,8 +91,10 @@ export default () => [
uniStatLog
(
M
[
'
stat.warn.tip
'
].
replace
(
'
{version}
'
,
`
${
statVersion
}
.0`
)
)
if
(
statVersion
===
'
2
'
)
{
uniStatDeviceLog
(
'
【重要】因 HBuilderX 3.4.9 版本起,uni统计2.0 调整了安卓端 deviceId 获取方式,导致 uni统计2.0 App-Android平台部分统计数据不准确。如使用了HBuilderX 3.4.9 - 3.6.4版本且开通了uni统计2.0的应用,需要使用HBuilderX3.6.7及以上版本重新发布应用并升级 uniAdmin 云函数解决,详见:https://ask.dcloud.net.cn/article/40097
'
)
if
(
statVersion
===
'
2
'
)
{
uniStatDeviceLog
(
'
【重要】因 HBuilderX 3.4.9 版本起,uni统计2.0 调整了安卓端 deviceId 获取方式,导致 uni统计2.0 App-Android平台部分统计数据不准确。如使用了HBuilderX 3.4.9 - 3.6.4版本且开通了uni统计2.0的应用,需要使用HBuilderX3.6.7及以上版本重新发布应用并升级 uniAdmin 云函数解决,详见:https://ask.dcloud.net.cn/article/40097
'
)
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录