企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ <title>Document</title> <script src="https://cdn.bootcss.com/vue/2.6.6/vue.js"></script> <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script> </head> <body> <div id="app"> <img :src="imgUrl" alt=""> <p>评分:<span>{{average}}</span></p> <form> <input type="text" v-model="keyValue"> <input type="button" value="搜索" @click="handleClick"> </form> </div> <script> new Vue({ el:"#app", data:{ imgUrl:"https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2395733377.webp", average:8.2, keyValue:"绿皮书" }, methods:{ handleClick(){ var url = "https://douban.uieee.com/v2/movie/search?q="+this.keyValue+"&count=1"; $.ajax({ url, type:"get", dataType:"jsonp", success:res=>{ var subjects = res.subjects[0]; var {rating,images}=subjects; var average = rating.average; var imgUrl = images.small; this.imgUrl = imgUrl; this.average = average; } }) } } }) </script> </body> ~~~