Data Is Clearing When I Click Route Page About In Vue
Help me please! I have two pages: Home, About and a component SecondPage. This component has two tables with data, and it should be displayed on About page. But when I navigate to
Solution 1:
Vue documentation indicates Prop Casing (camelCase vs kebab-case)
HTML attribute names are case-insensitive, so browsers will interpret any uppercase characters as lowercase. That means when you’re using in-DOM templates, camelCased prop names need to use their kebab-cased (hyphen-delimited) equivalents:
Then when u call some component in his HTML template you should write the prop in kebab-case:
<!-- kebab-case in HTML --><blog-postpost-title="hello!"></blog-post>
And on your component u must to call your props in camelCase:
Vue.component('blog-post', {
// camelCase in JavaScript
props: ['postTitle'],
template: '<h3>{{ postTitle }}</h3>'
})
Solution 2:
I added store
with Vuex
, and this problem was solved!
Post a Comment for "Data Is Clearing When I Click Route Page About In Vue"