<h2 style="Box-sizing: border-Box; font-weight: 500; line-height: 1.225; color: rgb(51,51,51); margin: 1.5em 0px 0.6em; font-size: 30px; padding-bottom: 0.3em; border-bottom: 1px solid rgb(238,238,238); white-space: normal;">vue模糊匹配,监听输入框内容改变
Meta charset="UTF-8">方法体 methods: { getAnswer: _.debounce( function () { if (this.question.indexOf('?') === -1) { this.answer = 'Questions usually contain a question mark. ;-)' return } this.answer = 'Thinking...' var vm = this axios.get('https://yesno.wtf/api') .then(function (response) { console.log(response); vm.answer = response.data.image; }) .catch(function (error) { vm.answer = 'Error! Could not reach the API. ' + error }) }, // 这是我们为判定用户停止输入等待的毫秒数 500 ) }, watch: { // 如果 `question` 发生改变,这个函数就会运行 question: function (newQuestion, oldQuestion) { this.answer = 'Waiting for you to stop typing...' this.getAnswer() } } });