鍍金池/ 問答/HTML5  HTML/ Vue的報錯,一個仿造百度的下拉菜單

Vue的報錯,一個仿造百度的下拉菜單

報的錯誤是:

clipboard.png

下面是代碼:
<template>
<div>
<div class="container search-container" id="app">

<h1 class="title" >baidu-search</h1>
<input type="text" class="form-control" placeholder="請輸入想要搜索關(guān)鍵字" v-model="keyword" @keyup="get($event)" @keydown.down.prevent="selectDown"
@keydown.up.prevent="selectUp">
<ul>
    <li class="text-center" v-for="(value,index) in myData"><span class="text-success textprimary" :class="{gray:index==now}">{{value}}</span></li>
</ul>
<p ><h2 v-show="myData.length==0" class="text-warning text-center">(*^__^*)暫時沒有數(shù)據(jù)</h2></p>

</div>
</div>
</template>

<script>

export default {
data(){

 return{
        myData:[],
        keyword:'',
        now:-1
    }

},
    methods:{
        get:function (event) {
            if(event.keyCode==38||event.keyCode==40)return;
            if(event.keyCode==13){
                window.open('https://www.baidu.com/s?wd='+this.keyword);
                this.keyword=''
            }
            this.$http.jsonp('https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su',{
                wd:this.keyword
            },{
                jsonp:'cb'
            }).then(function (res) {
                this.myData=res.data.s;
            },function () {

            });
        },
        selectDown:function () {
            this.now++;
            if(this.now==this.myData.length)this.now=-1;
            this.keyword=this.myData[this.now];
        },
        selectUp:function () {
            this.now--;
            if(this.now==-2)this.now=this.myData.length-1;
            this.keyword=this.myData[this.now];
        }
    }

}
</script>

<style scoped>

</style>

回答
編輯回答
久礙你

同樓上 sug在哪里

2017年8月29日 22:38
編輯回答
笑浮塵

哪有個sug (漂亮的姑娘?)

2018年2月1日 20:28
編輯回答
熟稔

看到錯誤,我突然發(fā)現(xiàn)似乎也遇到過,似乎是熱更新導(dǎo)致的,重新刷新一下試試咯

2017年12月9日 07:32