@vitarx/plugin-vite 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -108,13 +108,14 @@ ctx // 转换上下文,包含转换过程中的相关信息
|
|
|
108
108
|
if (isStaticValue(value)) {
|
|
109
109
|
return t.objectProperty(keyNode, value);
|
|
110
110
|
}
|
|
111
|
+
// 绑定目标必须保留引用本身,成员访问和调用结果也不能按普通属性解包。
|
|
112
|
+
if (key === 'ref') {
|
|
113
|
+
return t.objectProperty(keyNode, value);
|
|
114
|
+
}
|
|
111
115
|
// 如果是标识符(变量名)
|
|
112
116
|
if (t.isIdentifier(value)) {
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
// - ref: ref 绑定需要 ref 对象本身,运行时通过 isRef() 判定后赋值 .value
|
|
116
|
-
// 若此处 unref/.value 解包,popProperty 取到解包值(如 null),isRef 失败
|
|
117
|
-
if (key === 'children' || key === 'ref') {
|
|
117
|
+
// children 允许 ref 作为可变渲染源,保持引用本身。
|
|
118
|
+
if (key === 'children') {
|
|
118
119
|
return t.objectProperty(keyNode, value);
|
|
119
120
|
}
|
|
120
121
|
// 已知非 ref 变量(函数声明、箭头函数等):静态分析确定非 ref,直接赋值无需 unref
|