refactor: rename vnode hooks

So that they can be used as @vnodeMounted="..." in templates
This commit is contained in:
Evan You
2019-10-18 14:01:45 -04:00
parent 3cd2f7e68e
commit b5194b16bf
4 changed files with 16 additions and 17 deletions

View File

@@ -52,9 +52,8 @@ export const toTypeString = (value: unknown): string =>
export const isPlainObject = (val: any): val is object =>
toTypeString(val) === '[object Object]'
const vnodeHooksRE = /^vnode/
export const isReservedProp = (key: string): boolean =>
key === 'key' || key === 'ref' || key === '$once' || vnodeHooksRE.test(key)
key === 'key' || key === 'ref' || key === '$once' || key.startsWith(`onVnode`)
const camelizeRE = /-(\w)/g
export const camelize = (str: string): string => {

View File

@@ -41,8 +41,8 @@ export const enum PatchFlags {
FULL_PROPS = 1 << 4,
// Indicates an element that only needs non-props patching, e.g. ref or
// directives (vnodeXXX hooks). It simply marks the vnode as "need patch",
// since every patched vnode checks for refs and vnodeXXX hooks.
// directives (onVnodeXXX hooks). It simply marks the vnode as "need patch",
// since every patched vnode checks for refs and onVnodeXXX hooks.
// This flag is never directly matched against, it simply serves as a non-zero
// value.
NEED_PATCH = 1 << 5,