千峰商城-springboot项目搭建-58-轮播图前端功能实现
作者:互联网
当进入到index.html,在进行页面初始化之后,就需要请求轮播图数据进行轮播图的显示。
<script type="text/javascript"> var baseUrl="http://localhost:8080/"; var vm = new Vue({ el:"#container", data:{ username:"", userimg:"", isLogin:false, indexImgs:[] }, created(){ //从cookie中获取token username userImg var token = getCookieValue("token"); if(token != null && token != ""){ this.isLogin = true; this.username = getCookieValue("username"); this.userimg = getCookieValue("userimg"); } //请求轮播图数据 var url = baseUrl + "/index/indeximg"; axios.get(url).then((res)=>{ var vo = res.data; this.indexImgs = vo.data; //渲染轮播图 //初始化轮播图动画效果 setTimeout(function(){ $('.am-slider').flexslider(); },100); }); } }); </script>
标签:username,springboot,userimg,轮播,token,var,getCookieValue,58 来源: https://www.cnblogs.com/lysboke/p/16489832.html