Skip to content

enable implicit event (v-on) and var (v-bind) declarations: e.g. <a @click :title>hello!</a> #9253

Closed
@frudman

Description

@frudman

What problem does this feature solve?

make template html more DRY by reducing simple component (self-evident?) definitions.

Many times I find that I declare event methods using the same name as the underlying event, such as

<a @click=click @mouseover=mouseover :title=title>hello</a>

(where click and mouseover are of course defined as methods for the component, and title is declared within the data() object).

A cleaner way to do this (imho, and in keeping with javascript's shorthand object notation: e.g. const x = { a, b, c }), a cleaner way may look like this:

<a @click @mouseover :title>hello</a>

This concept could also be extended to binding of variables & props (e.g. :title=title becomes :title).

What does the proposed API look like?

the API would not (should not need to) be changed as this would affect only the initial parsing of a template's html.

I suspect the parts of the code to be modified would be here and here but those were too involved for me to attempt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions