问题
官网demo正常https://weex-project.io/examples/indicator.html,用playground扫码打开,指示器就是不显示。
解决方案
<template>
<div>
<slider class="slider" interval="1000" auto-play="true" @change="onchange">
<div class="frame" v-for="img in imageList">
<image class="image" resize="cover" :src="img.src"></image>
</div>
<indicator class="indicator"></indicator>
</slider>
</div>
</template>
<style scoped>
.image {
width: 750px;
height: 350px;
}
.slider {
margin-bottom: 25px;
width: 750px;
height: 350px;
}
.frame {
width: 750px;
height: 350px;
position: relative;
}
.indicator{
position: absolute;
width: 750px;
height: 300px;
item-color: green;
item-selected-color: red;
item-size: 50px;
}
</style>
<script>
export default {
data() {
return {
imageList: [
{ src: 'https://gd2.alicdn.com/bao/uploaded/i2/T14H1LFwBcXXXXXXXX_!!0-item_pic.jpg'},
{ src: 'https://gd1.alicdn.com/bao/uploaded/i1/TB1PXJCJFXXXXciXFXXXXXXXXXX_!!0-item_pic.jpg'},
{ src: 'https://gd3.alicdn.com/bao/uploaded/i3/TB1x6hYLXXXXXazXVXXXXXXXXXX_!!0-item_pic.jpg'}
]
}
}
}
</script>
<indicator class="indicator"></indicator>要加position属性,如:position: absolute;