In the vue project, the vue encountered a problem when performing the editing function to transmit data.

Source: Internet
Author: User

In the vue project, the vue encountered a problem when performing the editing function to transmit data.

When editing a project, you encounter the following problem: the editing function uses a sub-component as the pop-up box,


This involves the problem of transferring data from the parent component to the child component. This project uses v1.0. The problem is that after you click Edit, the pop-up child component does not obtain the data transmitted by the parent component. No code error is found after the check. The final solution is in the parent component, initialize each item in the passed data.

CreatIssue (type, list, id) {this. modelIssue = true; this. modeltype = type; if (type = 'creat') {this.listdb.exe cutorName = ''; this.listdb.exe cutorId =''; this. listdb. state = ''; this. listdb. projVerId = ''; this. listdb. content = ''; this. issueTitle = "Create Question to";} else if (type = 'edit') {this. listdb = {... list}; // deconstruct data. Only the list value is used, and the list address is not required. this. editId = id; this. issueTitle = "Edit question ";}},

This is the method executed when you click Edit. The following is the data passed to the child component.

listdb:{  executorName:'',  executorId:'',  state:'',  ProjVerId:'',  content:''},

At the beginning, only an empty data is defined as follows:

Listdb :{},

In this case, data will not be transmitted to the child component. After defining each item to be passed, it will be fine, just like the above method.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.