版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36663951/article/details/82687336
<script src="vue.js"></script> <script src="node_modules/axios/dist/axios.js"></script> <script src="node_modules/lodash/lodash.js"></script> <script> var app=new Vue({ el:'#div', watch:{ //使用debounce时,需要使用:npm install lodash安装lodash。 word:_.debounce( function(x,j){ console.log(x+'=>'+j) axios.get('index.php?word='+x).then(function(response){ console.log(response.data) console.log(response.status) app.result=response.data }) },100 ) }, data:{ word:'', result:'' } }) </script>