How to pass parameters from parent to child component in vue.js

php中世界最好的语言
Release: 2017-12-31 10:33:55
Original
1496 people have browsed it

What I bring to you this time is how to pass parameters from parent to child components in vue.js. This article will give you a good analysis.

1. Create a new componentA.vue component with the following code:

const STORAGE_KEY = 'todos-vue.js' export default{ fetch(){ return JSON.parse(window.localStorage.getItem(STORAGE_KEY) || '[]') }, save(items){ window.localStorage.setItem(STORAGE_KEY,JSON.stringify(items)); } }
Copy after login

App.vue code is as follows:


  
Copy after login

componentA.vue code As follows:


 < 
Copy after login

I believe you have mastered the method after reading the above introduction. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:


How to use Vue’s custom instructions to complete a drop-down menu

How can JS click to jump to the logged-in personal mailbox

nvm's method of managing different versions of node

The above is the detailed content of How to pass parameters from parent to child component in vue.js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!