Home > Backend Development > PHP Tutorial > How does vue.js obtain and parse the array passed by php?

How does vue.js obtain and parse the array passed by php?

PHP中文网
Release: 2023-03-01 06:26:01
Original
2599 people have browsed it

How does vue.js obtain and parse the array passed by php?

How does vue.js obtain and parse the array passed by php?
The data required in the items here is obtained from the background through vue
How does vue.js obtain and parse the array passed by php?
This is the data passed from the background php page

Now the question is, how to connect them and get them Put the content into items according to the format obtained

Answer:

Convert the data to json format, and then write it in the js file

created:function(){
    //用ajax或者vue-resource获取你的数据,并绑定到items里面
    
$.getJSON('url',function (items) {
            this.items=items;
           }.bind(this));}
Copy after login
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 Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template