61 行
1.3 KiB
Plaintext
61 行
1.3 KiB
Plaintext
<template>
|
||
<view>
|
||
<text>computed属性在设置duration=0的测试:</text>
|
||
<swiper :current="current" :vertical="true" :duration="0" style="height: 100px; width: 100%;">
|
||
<swiper-item v-for="item,index in data.list" :key="item.id">
|
||
<view>
|
||
当前实际渲染的值:{{index}},指定current的值:{{current}}
|
||
</view>
|
||
</swiper-item>
|
||
</swiper>
|
||
<text>同时设置autoplay / circular / duration的测试:</text>
|
||
<swiper id="swiper-view" :autoplay="true" :interval="3000" :circular="true" :duration="3000" :current="0" style="height: 100px; width: 100%;">
|
||
<swiper-item >
|
||
<text>0000000000000000000</text>
|
||
</swiper-item>
|
||
<swiper-item >
|
||
<text>111111111111111111</text>
|
||
</swiper-item>
|
||
</swiper>
|
||
</view>
|
||
|
||
</template>
|
||
|
||
<script setup lang="uts">
|
||
|
||
export type ListType={
|
||
id:number,
|
||
content:string
|
||
}
|
||
|
||
type DataType = {
|
||
list: ListType[],
|
||
}
|
||
|
||
// 使用reactive包装数据,便于自动化测试获取
|
||
const data = reactive({
|
||
list: [
|
||
{id:1,content:"第一个"},
|
||
{id:2,content:"第二个"},
|
||
] as ListType[],
|
||
} as DataType)
|
||
|
||
const current = computed(():number => {
|
||
return 1
|
||
})
|
||
|
||
//自动化测试例专用
|
||
function jest_getWindowInfo() : GetWindowInfoResult {
|
||
return uni.getWindowInfo();
|
||
}
|
||
|
||
defineExpose({
|
||
data,
|
||
jest_getWindowInfo
|
||
})
|
||
</script>
|
||
|
||
<style>
|
||
|
||
</style>
|