feat(transition): properly handle transition & transition-group in compiler
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { baseCompile, CompilerOptions, CodegenResult } from '@vue/compiler-core'
|
||||
import {
|
||||
baseCompile,
|
||||
CompilerOptions,
|
||||
CodegenResult,
|
||||
isBuiltInType
|
||||
} from '@vue/compiler-core'
|
||||
import { parserOptionsMinimal } from './parserOptionsMinimal'
|
||||
import { parserOptionsStandard } from './parserOptionsStandard'
|
||||
import { transformStyle } from './transforms/transformStyle'
|
||||
@@ -8,6 +13,7 @@ import { transformVText } from './transforms/vText'
|
||||
import { transformModel } from './transforms/vModel'
|
||||
import { transformOn } from './transforms/vOn'
|
||||
import { transformShow } from './transforms/vShow'
|
||||
import { TRANSITION, TRANSITION_GROUP } from './runtimeHelpers'
|
||||
|
||||
export function compile(
|
||||
template: string,
|
||||
@@ -25,6 +31,13 @@ export function compile(
|
||||
on: transformOn,
|
||||
show: transformShow,
|
||||
...(options.directiveTransforms || {})
|
||||
},
|
||||
isBuiltInComponent: tag => {
|
||||
if (isBuiltInType(tag, `Transition`)) {
|
||||
return TRANSITION
|
||||
} else if (isBuiltInType(tag, `TransitionGroup`)) {
|
||||
return TRANSITION_GROUP
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ export const V_ON_WITH_KEYS = Symbol(__DEV__ ? `vOnKeysGuard` : ``)
|
||||
|
||||
export const V_SHOW = Symbol(__DEV__ ? `vShow` : ``)
|
||||
|
||||
export const TRANSITION = Symbol(__DEV__ ? `Transition` : ``)
|
||||
export const TRANSITION_GROUP = Symbol(__DEV__ ? `TransitionGroup` : ``)
|
||||
|
||||
registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
@@ -19,5 +22,7 @@ registerRuntimeHelpers({
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user