feat(compile-core): handle falsy dynamic args for v-on and v-bind (#2393)

fix #2388
This commit is contained in:
ᴜɴвʏтᴇ
2020-10-20 05:15:53 +08:00
committed by GitHub
parent 7390487c7d
commit 052a621762
15 changed files with 96 additions and 71 deletions

View File

@@ -1,15 +1,15 @@
import {
ComponentInternalInstance,
LifecycleHooks,
currentInstance,
setCurrentInstance,
isInSSRComponentSetup
isInSSRComponentSetup,
LifecycleHooks,
setCurrentInstance
} from './component'
import { ComponentPublicInstance } from './componentPublicInstance'
import { callWithAsyncErrorHandling, ErrorTypeStrings } from './errorHandling'
import { warn } from './warning'
import { capitalize } from '@vue/shared'
import { pauseTracking, resetTracking, DebuggerEvent } from '@vue/reactivity'
import { toHandlerKey } from '@vue/shared'
import { DebuggerEvent, pauseTracking, resetTracking } from '@vue/reactivity'
export { onActivated, onDeactivated } from './components/KeepAlive'
@@ -49,9 +49,7 @@ export function injectHook(
}
return wrappedHook
} else if (__DEV__) {
const apiName = `on${capitalize(
ErrorTypeStrings[type].replace(/ hook$/, '')
)}`
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ''))
warn(
`${apiName} is called when there is no active component instance to be ` +
`associated with. ` +