feat(core): support v-show directive (#310)

This commit is contained in:
likui
2019-11-25 11:04:26 +08:00
committed by Evan You
parent 1765985ec2
commit 00857ac816
9 changed files with 253 additions and 4 deletions

View File

@@ -1 +1,17 @@
// TODO
import { DirectiveTransform } from '@vue/compiler-core'
import { createDOMCompilerError, DOMErrorCodes } from '../errors'
import { V_SHOW } from '../runtimeHelpers'
export const transformShow: DirectiveTransform = (dir, node, context) => {
const { exp, loc } = dir
if (!exp) {
context.onError(
createDOMCompilerError(DOMErrorCodes.X_V_SHOW_NO_EXPRESSION, loc)
)
}
return {
props: [],
needRuntime: context.helper(V_SHOW)
}
}