提交 a847f5f0 编写于 作者: W WOSHIMAHAIFENG

Merge branch 'dev' of https://gitcode.net/dcloud/hello-uni-app-x into dev-payment

...@@ -1080,7 +1080,8 @@ ...@@ -1080,7 +1080,8 @@
{ {
"path": "pages/template/swiper-vertical-video/swiper-vertical-video", "path": "pages/template/swiper-vertical-video/swiper-vertical-video",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
} }
}, },
// #ifdef APP // #ifdef APP
...@@ -1095,7 +1096,8 @@ ...@@ -1095,7 +1096,8 @@
"path": "pages/template/scroll-fold-nav/scroll-fold-nav", "path": "pages/template/scroll-fold-nav/scroll-fold-nav",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "transparent"
} }
}, },
{ {
...@@ -1110,7 +1112,6 @@ ...@@ -1110,7 +1112,6 @@
"navigationBarTitleText": "半屏弹窗" "navigationBarTitleText": "半屏弹窗"
} }
}, },
// #ifdef APP
{ {
"path": "pages/template/long-list/long-list", "path": "pages/template/long-list/long-list",
"style": { "style": {
...@@ -1125,11 +1126,11 @@ ...@@ -1125,11 +1126,11 @@
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
}, },
// #endif
{ {
"path": "pages/template/pull-zoom-image/pull-zoom-image", "path": "pages/template/pull-zoom-image/pull-zoom-image",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
} }
}, },
{ {
...@@ -1178,14 +1179,16 @@ ...@@ -1178,14 +1179,16 @@
"path": "pages/webview-screenshot-comparison/webview-screenshot-comparison", "path": "pages/webview-screenshot-comparison/webview-screenshot-comparison",
"style": { "style": {
"navigationBarTitleText": "截图对比测试", "navigationBarTitleText": "截图对比测试",
"navigationStyle": "custom" "navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
} }
}, },
{ {
"path": "pages/webview-screenshot/webview-screenshot", "path": "pages/webview-screenshot/webview-screenshot",
"style": { "style": {
"navigationBarTitleText": "webview 截图测试", "navigationBarTitleText": "webview 截图测试",
"navigationStyle": "custom" "navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
} }
}, },
// #ifdef APP // #ifdef APP
...@@ -1209,8 +1212,14 @@ ...@@ -1209,8 +1212,14 @@
"navigationBarTitleText": "支付", "navigationBarTitleText": "支付",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
},
{
"path": "pages/component/list-view/list-view-refresh",
"style": {
"navigationBarTitleText": "list-view-refresh",
"enablePullDownRefresh": false
}
} }
// #endif // #endif
], ],
"globalStyle": { "globalStyle": {
......
describe('component-native-list-view-refresh', () => {
if (process.env.uniTestPlatformInfo.startsWith('web')) {
it('dummyTest', async () => {
expect(1).toBe(1)
})
return
}
let page
beforeAll(async () => {
//打开list-view测试页
page = await program.reLaunch('/pages/component/list-view/list-view-refresh')
await page.waitFor(600)
})
it('check_list_view_refresh', async () => {
await page.waitFor(async () => {
return await page.data('refresherTriggered') === false;
});
//等待下拉刷新结束
await page.waitFor(500)
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
})
})
<template>
<list-view v-if="list_show" id="listview" style="flex: 1;" show-scrollbar=false :refresher-enabled="true"
:refresher-triggered="refresherTriggered" @refresherrefresh="onRefresherrefresh">
<list-item class="item">
<text>向下滑动触发下拉刷新</text>
</list-item>
<list-item v-for="index in item_count" class="item">
<text>item-------{{index}}</text>
</list-item>
</list-view>
</template>
<script>
export default {
data() {
return {
item_count: 20,
list_show: false,
refresherTriggered: true
}
},
onLoad() {
//延迟显示list-view
setTimeout(() => {
this.list_show = true;
}, 500)
},
methods: {
onRefresherrefresh() {
this.refresherTriggered = true;
setTimeout(() => {
this.refresherTriggered = false;
}, 1000)
}
}
}
</script>
<style>
.item {
padding: 15px;
margin: 0 0 5px 0;
background-color: #fff;
border-radius: 5px;
}
.button_item {
width: 200px;
}
</style>
...@@ -182,7 +182,11 @@ ...@@ -182,7 +182,11 @@
@confirm="confirm_refresher_background_input"></input-data> @confirm="confirm_refresher_background_input"></input-data>
<enum-data :items="size_enum" title="通过id位置跳转" @change="item_change_size_enum"></enum-data> <enum-data :items="size_enum" title="通过id位置跳转" @change="item_change_size_enum"></enum-data>
<navigator url="/pages/component/list-view/list-view-refresh" hover-class="none">
<button type="primary" class="button">
list-view 下拉刷新
</button>
</navigator>
<navigator url="/pages/component/list-view/list-view-multiplex" hover-class="none"> <navigator url="/pages/component/list-view/list-view-multiplex" hover-class="none">
<button type="primary" class="button"> <button type="primary" class="button">
list-view 对list-item复用测试 list-view 对list-item复用测试
......
...@@ -20,4 +20,12 @@ describe('text-props', () => { ...@@ -20,4 +20,12 @@ describe('text-props', () => {
expect(height).toBe(0) expect(height).toBe(0)
} }
}) })
it('text nested', async () => {
page.callMethod("setTextNested")
const element = await page.$('#text-nested')
if (element != null) {
expect(await element.text()).toBe("二级节点文字红色且背景色黄色")
}
})
}) })
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<view class="text-box"> <view class="text-box">
<text <text
>一级节点黑色 >一级节点黑色
<text style="color: red;background-color: yellow;" <text id="text-nested" ref="text-nested" style="color: red;background-color: yellow;"
>二级节点红色且背景色黄色 >二级节点红色且背景色黄色
<text>三级节点不继承二级的颜色</text> <text>三级节点不继承二级的颜色</text>
</text> </text>
...@@ -114,7 +114,12 @@ export default { ...@@ -114,7 +114,12 @@ export default {
singleLineText: 'uni-app x,终极跨平台方案', singleLineText: 'uni-app x,终极跨平台方案',
} }
}, },
methods: {}, methods: {
// 自动化测试
setTextNested() {
(this.$refs["text-nested"] as UniTextElement).value = "二级节点文字红色且背景色黄色";
}
}
} }
</script> </script>
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
data() { data() {
return { return {
list: [ list: [
// #ifdef APP
{ {
id: 'long-list', id: 'long-list',
url: 'long-list', url: 'long-list',
...@@ -73,7 +72,6 @@ ...@@ -73,7 +72,6 @@
}, },
] as Page[], ] as Page[],
}, },
// #endif
{ {
id: 'list-news', id: 'list-news',
url: 'list-news', url: 'list-news',
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<view class="swiper-list"> <view class="swiper-list">
<scroll-view ref="tabScroll" class="swiper-tabs" direction="horizontal" :show-scrollbar="false"> <scroll-view ref="tabScroll" class="swiper-tabs" direction="horizontal" :show-scrollbar="false">
<view class="flex-row" style="align-self: flex-start;"> <view class="flex-row" style="align-self: flex-start;">
<text ref="swipertab" class="swiper-tabs-item" :class="swiperIndex==index ? 'swiper-tabs-item-active' : ''" <text ref="swipertab" space="nbsp" class="swiper-tabs-item" :class="swiperIndex==index ? 'swiper-tabs-item-active' : ''"
v-for="(item, index) in swiperList" :key="index" @click="onTabClick(index)"> v-for="(item, index) in swiperList" :key="index" @click="onTabClick(index)">
{{item.name}} {{item.name}}
</text> </text>
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
// 滚动到水平中心位置 // 滚动到水平中心位置
const scroll_x = x - this.swiperWidth / 2 const scroll_x = x - this.swiperWidth / 2
if(this.tabScrollView !== null){ if(this.tabScrollView != null){
this.tabScrollView!.scrollLeft = scroll_x this.tabScrollView!.scrollLeft = scroll_x
} }
}, },
...@@ -238,6 +238,9 @@ ...@@ -238,6 +238,9 @@
.swiper-list { .swiper-list {
height: 100%; height: 100%;
/* #ifdef WEB */
flex: 1;
/* #endif */
} }
.swiper-tabs { .swiper-tabs {
...@@ -249,6 +252,7 @@ ...@@ -249,6 +252,7 @@
color: #555; color: #555;
font-size: 16px; font-size: 16px;
padding: 12px 25px; padding: 12px 25px;
white-space: nowrap;
} }
.swiper-tabs-item-active { .swiper-tabs-item-active {
......
...@@ -165,7 +165,9 @@ ...@@ -165,7 +165,9 @@
const percentage = Math.abs(current_offset_x) / this.swiperWidth const percentage = Math.abs(current_offset_x) / this.swiperWidth
// 通知更新指示线 // 通知更新指示线
if (current_index != move_to_index) {
this.updateTabIndicator(current_index, move_to_index, percentage) this.updateTabIndicator(current_index, move_to_index, percentage)
}
// 首次可见时初始化数据 // 首次可见时初始化数据
this.initSwiperItemData(move_to_index) this.initSwiperItemData(move_to_index)
...@@ -242,6 +244,9 @@ ...@@ -242,6 +244,9 @@
.swiper-list { .swiper-list {
height: 100%; height: 100%;
/* #ifdef WEB */
flex: 1;
/* #endif */
} }
.swiper-tabs { .swiper-tabs {
...@@ -253,6 +258,7 @@ ...@@ -253,6 +258,7 @@
color: #555; color: #555;
font-size: 16px; font-size: 16px;
padding: 12px 25px; padding: 12px 25px;
white-space: nowrap;
} }
.swiper-tabs-item-active { .swiper-tabs-item-active {
......
...@@ -191,6 +191,7 @@ ...@@ -191,6 +191,7 @@
color: #555; color: #555;
font-size: 16px; font-size: 16px;
padding: 12px 25px; padding: 12px 25px;
white-space: nowrap;
} }
.swiper-tabs-item-active { .swiper-tabs-item-active {
......
...@@ -143,6 +143,7 @@ ...@@ -143,6 +143,7 @@
color: #555; color: #555;
font-size: 16px; font-size: 16px;
margin: 15px 25px 5px 25px; margin: 15px 25px 5px 25px;
white-space: nowrap;
} }
.swiper-tabs-item-active { .swiper-tabs-item-active {
......
## 1.0.6(2024-02-28)
- 更新 Circle 组件名称,防止与内置组件名冲突
## 1.0.5(2024-01-12) ## 1.0.5(2024-01-12)
- 优化 删除组件内无用日志输出 - 优化 删除组件内无用日志输出
## 1.0.4(2024-01-10) ## 1.0.4(2024-01-10)
......
<template>
<view :ref="elId" class="block" :style="{width:size+'px',height:size+'px'}"></view>
</template>
<script>
import { hexToRgba } from './util'
export default {
name: "uni-snow",
props: {
speed: {
type: Number,
default: 16,
},
size: {
type: Number,
default: 20,
},
color: {
type: String,
default: '',
}
},
data() {
const elId = `Uni_${(Math.random() * 10e5).toInt().toString(36)}`
return {
elId: elId,
timer: 0,
};
},
mounted() {
const refs = this.$refs[this.elId] as UniElement
let ctx = refs.getDrawableContext()!
this.spinner(ctx)
},
unmounted() {
clearInterval(this.timer)
},
methods: {
spinner(ctx : DrawableContext) {
const steps = 12;
let step = 0;
const width = this.size;
const lineWidth = width / 12;
// 线长度和距离圆心距离
const length = width / 4 - lineWidth;
const offset = width / 4;
function draw() {
ctx.reset();
for (let i = 0; i < steps; i++) {
const stepAngle = 360 / steps;
const angle = stepAngle * i;
// 计算透明度
const opacity = ((steps - (step % steps)) * stepAngle + angle) % 360 + 30;
// 计算正余弦值
const sin = Math.sin((angle / 180) * Math.PI);
const cos = Math.cos((angle / 180) * Math.PI);
// 开始绘制线条
ctx.lineWidth = lineWidth;
ctx.lineCap = 'round';
ctx.beginPath();
ctx.moveTo(width / 2 + offset * cos, width / 2 + offset * sin);
ctx.lineTo(
width / 2 + (offset + length) * cos,
width / 2 + (offset + length) * sin
);
// 获取填充颜色
const fillColor = this.color !== '' ? this.color : '#333333';
// 转换透明度并设置颜色
ctx.strokeStyle = hexToRgba(fillColor, Math.round((opacity / 360) * 255));
ctx.stroke();
}
step += 1;
ctx.update();
}
draw()
// 每隔一段时间执行绘制函数
this.timer = setInterval(() => draw(), this.speed + 76);
}
}
}
</script>
<style scoped>
.block {
width: 50px;
height: 50px;
}
</style>
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
<template v-if="loading"> <template v-if="loading">
<slot></slot> <slot></slot>
<template v-if="$slots['default'] == null"> <template v-if="$slots['default'] == null">
<Circle :speed="16" :size="loadWidth" :color="color"></Circle> <LoadingCircle :speed="16" :size="loadWidth" :color="color"></LoadingCircle>
<text v-if="text" class="inline-text" :style=" { color: color }">{{text}}</text> <text v-if="text" class="inline-text" :style=" { color: color }">{{text}}</text>
</template> </template>
<template v-else> <template v-else>
<view class="uni-loading-mask" :style="{backgroundColor:background}"> <view class="uni-loading-mask" :style="{backgroundColor:background}">
<Circle :speed="16" :size="loadWidth" :color="color"></Circle> <LoadingCircle :speed="16" :size="loadWidth" :color="color"></LoadingCircle>
<text v-if="text" class="block-text" :style=" { color: color }">{{text}}</text> <text v-if="text" class="block-text" :style=" { color: color }">{{text}}</text>
</view> </view>
</template> </template>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</view> </view>
</template> </template>
<script> <script>
import Circle from './circle.uvue' import LoadingCircle from './loading-circle.uvue'
// TODO 性能问题,其他类型暂时不对外开放 // TODO 性能问题,其他类型暂时不对外开放
// import Icon from './icon.uvue' // import Icon from './icon.uvue'
// import UniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.uvue' // import UniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.uvue'
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
export default { export default {
name: "uni-loading", name: "uni-loading",
components: { Circle }, components: { LoadingCircle },
props: { props: {
loading: { loading: {
type: Boolean, type: Boolean,
......
{ {
"id": "uni-loading", "id": "uni-loading",
"displayName": "uni-loading", "displayName": "uni-loading",
"version": "1.0.5", "version": "1.0.6",
"description": "加载动画组件多用在页面内数据加载时,提供一个loading动画,列表的上拉加载,下拉刷新等都需要加载动画", "description": "加载动画组件多用在页面内数据加载时,提供一个loading动画,列表的上拉加载,下拉刷新等都需要加载动画",
"keywords": [ "keywords": [
"loading", "loading",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册