|
|
@@ -28,6 +28,7 @@ import {
|
|
|
createSequenceExpression,
|
|
|
createSimpleExpression,
|
|
|
createTemplateLiteral,
|
|
|
+ findDir,
|
|
|
hasDynamicKeyVBind,
|
|
|
isStaticArgOf,
|
|
|
isStaticExp,
|
|
|
@@ -164,24 +165,28 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
|
|
|
]
|
|
|
}
|
|
|
} else if (directives.length && !node.children.length) {
|
|
|
- const tempId = `_temp${context.temps++}`
|
|
|
- propsExp.arguments = [
|
|
|
- createAssignmentExpression(
|
|
|
- createSimpleExpression(tempId, false),
|
|
|
- mergedProps,
|
|
|
- ),
|
|
|
- ]
|
|
|
- rawChildrenMap.set(
|
|
|
- node,
|
|
|
- createConditionalExpression(
|
|
|
- createSimpleExpression(`"textContent" in ${tempId}`, false),
|
|
|
- createCallExpression(context.helper(SSR_INTERPOLATE), [
|
|
|
- createSimpleExpression(`${tempId}.textContent`, false),
|
|
|
- ]),
|
|
|
- createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
|
|
|
- false,
|
|
|
- ),
|
|
|
- )
|
|
|
+ // v-text directive has higher priority than the merged props
|
|
|
+ const vText = findDir(node, 'text')
|
|
|
+ if (!vText) {
|
|
|
+ const tempId = `_temp${context.temps++}`
|
|
|
+ propsExp.arguments = [
|
|
|
+ createAssignmentExpression(
|
|
|
+ createSimpleExpression(tempId, false),
|
|
|
+ mergedProps,
|
|
|
+ ),
|
|
|
+ ]
|
|
|
+ rawChildrenMap.set(
|
|
|
+ node,
|
|
|
+ createConditionalExpression(
|
|
|
+ createSimpleExpression(`"textContent" in ${tempId}`, false),
|
|
|
+ createCallExpression(context.helper(SSR_INTERPOLATE), [
|
|
|
+ createSimpleExpression(`${tempId}.textContent`, false),
|
|
|
+ ]),
|
|
|
+ createSimpleExpression(`${tempId}.innerHTML ?? ''`, false),
|
|
|
+ false,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (needTagForRuntime) {
|