|
android 和iOS都不行
<template>
<scroll-view class="main" scroll-y>
<text class="title">通过v-for加载</text>
<swiper class="swiper" circular="false" indicator-dots indicator-color="#ddd" indicator-active-color="#f0f">
<swiper-item class="swiper-item" v-for="(_item,_index) in dataList">
<text class="desc">{_item}</text>
</swiper-item>
</swiper>
<text class="title" @click="changeList">改变数组</text>
</scroll-view>
</template>
<style>
.box{
flex-direction: row;
justify-content: space-between;
}
.box_item{
width: 48%;
}
.box_item_img{
width: 100%;
}
.main {
width: 100%;
height: 100%;
}
.swiper {
width: 100%;
height: 200px;
background-color: blue;
}
.swiper-item {
justify-content: center;
}
.title {
padding: 10px 0;
font-size: 20px;
}
.desc {
width: 100%;
text-align: center;
}
.container {
width: 100%;
height: 200px;
}
.indicator {
flex-direction: row;
justify-content: center;
position: absolute;
width: 100%;
height: 20px;
bottom: 8px;
}
.indicator-item {
width: 15px;
height: 8px;
margin: 3px;
}
.indicator-item-normal {
background-color: #ddd;
}
.indicator-item-active {
background-color: red;
}
</style>
<script>
export default {
name: 'test',
data(){
return {
info:"<p>第一行<p><p>第二行</p>",
dataList: ['item1', 'item2', 'item3', 'item4'],
current: 0,
change:false
}
},
methods:{
onchange(e){
this.data.current = e.detail.current;
},
changeList(){
this.change = !this.change;
if(this.change){
this.dataList = ['item1', 'item2']
}else{
this.dataList = ['item1', 'item2', 'item3', 'item4']
}
}
}
}
</script> |
|