国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

vue-resource獲取不到本地json文件的數(shù)據(jù)?
高洛峰
高洛峰 2016-11-10 15:33:50
0
2
1533
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>菜鳥</title>
    <script src="js/vue.js"></script>
    <script src="js/vue-resource.min.js"></script>
    <link href="example.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="example">
    <button id="but" >添加</button>
    <ul id="example1">
        <li v-for="item in items">
            {{ item.id }}
            {{ item.author }}
            
        </li>
    </ul>
    
</div>
<script>


 //在這里面寫Vue.js代碼
var example = new Vue({
  el: '#example',
  data: {
    items: [
      { id:'0',author:'我'}
    ]
  },
  ready:function(){
    this.$http.jsonp('1.json',{},{
        headers:{
        
        },
        emulateJSON: true
    }).then(function(response){
        alert('123');
    },function(response){
    
    });
  }
})


 //----------------
</script>
</body>
</html>

//瀏覽器無法彈出123


高洛峰
高洛峰

擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級(jí)軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...

reply all(2)
學(xué)霸

jsonp是跨域的,請求本地寫它干嘛 this.$http.get()就行了,具體回調(diào)函數(shù)看著也有問題 沒看你想請求什么數(shù)據(jù)..response參數(shù)也不用

三叔

必須在http或https協(xié)議下才能用AJAX,file協(xié)議下瀏覽器默認(rèn)禁用AJAX

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template