refactor(compiler): extract isStaticExp util

This commit is contained in:
Evan You
2020-07-13 16:48:16 -04:00
parent 8b320cc12f
commit 576344d2c3
6 changed files with 33 additions and 28 deletions

View File

@@ -24,7 +24,8 @@ import {
MERGE_PROPS,
isBindKey,
createSequenceExpression,
InterpolationNode
InterpolationNode,
isStaticExp
} from '@vue/compiler-dom'
import {
escapeHtml,
@@ -194,7 +195,7 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
}
for (let j = 0; j < props.length; j++) {
const { key, value } = props[j]
if (key.type === NodeTypes.SIMPLE_EXPRESSION && key.isStatic) {
if (isStaticExp(key)) {
let attrName = key.content
// static key attr
if (attrName === 'class') {