question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native modifier for props

See original GitHub issue

What 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:open
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
posvacommented, Aug 17, 2020

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

0reactions
Thanarathanamcommented, Oct 3, 2020

Can you add ‘hacktoberfest’ topic to the repository? It will make this repository participating in hacktoberfest.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found