2 Star 9 Fork 0

橙子/Mao-Scroll

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.vue 2.02 KB
一键复制 编辑 原始数据 按行查看 历史
<template>
<view>
<view class="main">
<view class="subject">抽奖结果</view>
<view class="body">
<maoScroll :data="data" :showNum="showNum" :lineHeight="lineHeight" :animationScroll="animationScroll" :animation="animation">
<template v-slot="{line}">
<view class="line">{{line.author}} 获得 {{line.subject}}</view>
</template>
</maoScroll>
</view>
</view>
<view class="main">
<view class="subject">滑动配置</view>
<view class="body">
<view><text>数据总数:</text><text>{{count}}条(模拟)</text></view>
<view><text>显示条数:</text><text>{{showNum}}条</text></view>
<view><text>每行高度:</text><text>{{lineHeight}}rpx</text></view>
<view><text>滑动时间:</text><text>{{animationScroll}}毫秒</text></view>
<view><text>滑动间隔:</text><text>{{animation}}毫秒</text></view>
</view>
</view>
</view>
</template>
<script>
import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
export default {
components:{
maoScroll
},
data() {
return {
title: 'Hello',
data: [],
count: 30,
showNum: 5,
lineHeight: 60,
animationScroll: 800,
animation: 2000,
}
},
onLoad() {
console.log('init');
console.log(this.data, '初始化数据 空数据');
let self = this;
setTimeout(function(){
console.log('模拟从网上获取数据 花费了1秒');
self.createData();
console.log(self.data, '获取到的数据');
}, 1000);
},
methods: {
createData: function(){
for(let i = 1; i <= this.count; i++){
this.data.push({
author: 'MaoUI',
subject: 'OnePlus手机 * ' + i + ''
})
}
}
}
}
</script>
<style>
.main{margin:30rpx;background-color: #FF6700;border-radius: 10rpx;border:1px solid #FF6700;}
.main .subject{height: 80rpx;font-size: 36rpx;text-align: center;line-height: 80rpx;color: #fff;}
.main .body{padding: 20rpx;background-color: #FFFFFF;}
.main .body .line{height: 60rpx;line-height: 60rpx;}
</style>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/XzcGroup/mao-scroll.git
git@gitee.com:XzcGroup/mao-scroll.git
XzcGroup
mao-scroll
Mao-Scroll
master

搜索帮助