Native modifier for props
See original GitHub issueWhat problem does this feature solve?
Consider the following component
<template>
<div>
{{title}}
</div>
</template>
<script>
export default {
name: 'awesomeTitle',
props: {
title: String
}
}
</script>
When using this component it now becomes impossible to set the title html attribute on the div
<awesomeTitle title="Hello world" title.native="Oopsy"/>
This would just output
<div title.native="Oopsy">Hello world</div>
Instead of
<div title="Oopsy">Hello world</div>
Adding the native modifier for props would permit to avoid collision between html attributes and vue props. It already exists for event listeners so it would also be more coherent.
Sometime libraries will forget that html attributes inheritance is a thing and adding some html attributes becomes impossible in those components, it will also make the component more future proof in case new html attributes are added in the spec as you don’t have to worry about future collisions anymore
What does the proposed API look like?
<awesomeTitle title="Hello world" title.native="Oopsy"/>
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
v-on.native modifier removed - Vue 3 Migration Guide
The .native modifier for v-on has been removed. At the same time, the new emits option allows the child to define which events...
Read more >When to use prop modifier in vue? - Stack Overflow
Modifiers : .prop - Bind as a DOM property instead of an attribute (what's the difference?). If the tag is a component then...
Read more >Vue.js Emit props & Sync modifier - Francium Tech
Vue.js Emit props & Sync modifier ... the parent component and update the properties with a event listener function. ... Set up React...
Read more >Props, States, and Events in VueJS Explained with Code ...
Props is a keyword that stands for Properties. ... default behavior, we can call the .prevent modifier in Vue, which calls the native...
Read more >VueJS - Different ways to implement v-model
... Custom prop and event (VueJS 2); The .sync modifier (VueJS 2) ... do not use the v-model in the native input, but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Using a prop with the same name as a native attribute when you want to allow that attribute is confusing. But I think this is worth going through an RFC to gather feedback: https://github.com/vuejs/rfcs
Can you add ‘hacktoberfest’ topic to the repository? It will make this repository participating in hacktoberfest.