From 424ef0415fa983bd09d29290ef216fd94ed32816 Mon Sep 17 00:00:00 2001 From: jhuddle <27450202+jhuddle@users.noreply.github.com> Date: Fri, 11 Mar 2022 02:20:56 +0100 Subject: [PATCH] Expose `$el` to `v-scope` This small change allows one to use element properties as values for props defined in `v-scope`... I'm finding it makes for a nice shorthand when trying to define such props on mount. For a toy example: ``` ``` vs. currently: ``` ``` --- src/walk.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/walk.ts b/src/walk.ts index f996461..5426a07 100644 --- a/src/walk.ts +++ b/src/walk.ts @@ -39,7 +39,7 @@ export const walk = (node: Node, ctx: Context): ChildNode | null | void => { // v-scope if ((exp = checkAttr(el, 'v-scope')) || exp === '') { - const scope = exp ? evaluate(ctx.scope, exp) : {} + const scope = exp ? evaluate(ctx.scope, exp, el) : {} ctx = createScopedContext(ctx, scope) if (scope.$template) { resolveTemplate(el, scope.$template)