Home  >  Article  >  Backend Development  >  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中文网
PHP中文网Original
2017-04-18 10:08:542530browse

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));}
Statement:
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