老师帮忙看下,一秒后loading页面消失了跟视频不一样
//slide.vue <template> <div class="slider-wapper"> <me-loading v-if="!sliders.length"/> <!-- <me-slider :data="sliders" :direction="direction" :loop="loop" :interval="interval" :pagination="pagination" v-if="sliders.length" > <swiper-slide v-for="(item, index) in sliders" :key="index" > <a :href="item.linkUrl" alt="" class='slider-link'> <img :src="item.picUrl" alt="" class='slider-img'> </a> </swiper-slide> </me-slider> --> </div> </template> <script> import MeSlider from 'base/slider'; import {swiperSlide} from 'vue-awesome-swiper'; import {sliderOptions} from './config'; import {getHomeSlider} from 'api/home'; import MeLoading from 'base/loading'; export default { name: 'HomeSlider', components:{ MeSlider, swiperSlide, MeLoading }, data(){ return{ direction: sliderOptions.direction, loop: sliderOptions.loop, interval: sliderOptions.interval, pagination: sliderOptions.pagination, sliders: [] } }, created(){ this.getSliders() }, methods:{ getSliders() { getHomeSlider().then(data =>{ this.sliders = data; }); } } } </script> <style lang="scss" scoped> .slider-wapper { width: 100%; height: 183px; } .slider-link { display: block; } .slider-link, .slider-img { overflow: hidden; width: 100%; height: 100%; } </style>
//loading/index.vue
<template> <div class="mine-loading"> <span class="mine-loading-indicator" v-if="indicator==='on'"> <slot><img src="./loading.gif" alt="loading"></slot> </span> <span class="mine-loading-text" v-if="text">{{text}}</span> </div> </template> <script> export default { name: 'MeLoading', props:{ indicator: { type: String, default: 'on', validator(value) { return ['on', 'off'].indexOf(value) > -1; } }, text:{ type:String, default:'加载中...' } } } </script> <style lang='scss' scoped> @import "~assets/scss/mixins"; .mine-loading{ overflow:hidden; width: 100%; height:100%; @include flex-center(column) } .mine-loading-indicator ~ .mine-loading-text{ margin-top: 6px; } </style>
18
收起
正在回答 回答被采纳积分+1
2回答
4.Vue与React高级框架开发
- 参与学习 人
- 提交作业 239 份
- 解答问题 10739 个
本阶段带你深入前端开发的肌理,通过ES6基础知识和前端主流高级框架的学习,助你快速构建企业级移动webAPP应用,进入职场的终极battle
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星