提交 a9e3e8eb 编写于 作者: shutao-dc's avatar shutao-dc

Merge remote-tracking branch 'remotes/origin/dev' into alpha

# Conflicts:
#	pages.json
......@@ -63,11 +63,10 @@
}
},
{
"path" : "pages/component/list-view/list-view-multiplex-input",
"style" :
{
"navigationBarTitleText" : "list-view复用input",
"enablePullDownRefresh" : false
"path": "pages/component/list-view/list-view-multiplex-input",
"style": {
"navigationBarTitleText": "list-view复用input",
"enablePullDownRefresh": false
}
},
{
......@@ -382,6 +381,13 @@
}
},
{
"path": "pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "设置状态栏颜色"
}
},
{
"path": "pages/API/set-navigation-bar-title/set-navigation-bar-title",
"style": {
"navigationBarTitleText": "设置导航条标题"
......@@ -1074,7 +1080,8 @@
{
"path": "pages/template/swiper-vertical-video/swiper-vertical-video",
"style": {
"navigationStyle": "custom"
"navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
}
},
// #ifdef APP
......@@ -1089,7 +1096,8 @@
"path": "pages/template/scroll-fold-nav/scroll-fold-nav",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "black"
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "transparent"
}
},
{
......@@ -1121,7 +1129,8 @@
{
"path": "pages/template/pull-zoom-image/pull-zoom-image",
"style": {
"navigationStyle": "custom"
"navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
}
},
{
......@@ -1170,14 +1179,16 @@
"path": "pages/webview-screenshot-comparison/webview-screenshot-comparison",
"style": {
"navigationBarTitleText": "截图对比测试",
"navigationStyle": "custom"
"navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
}
},
{
"path": "pages/webview-screenshot/webview-screenshot",
"style": {
"navigationBarTitleText": "webview 截图测试",
"navigationStyle": "custom"
"navigationStyle": "custom",
"navigationBarBackgroundColor": "transparent"
}
},
// #ifdef APP
......@@ -1201,8 +1212,14 @@
"navigationBarTitleText": "支付",
"enablePullDownRefresh": false
}
},
{
"path": "pages/component/list-view/list-view-refresh",
"style": {
"navigationBarTitleText": "list-view-refresh",
"enablePullDownRefresh": false
}
}
// #endif
],
"globalStyle": {
......
......@@ -31,9 +31,8 @@
provider: "alipay",
orderInfo: res.data as string,
fail: (res : RequestPaymentFail) => {
console.log(JSON.stringify(res))
const error = res as UniError
this.errorCode = error.errCode
console.log(JSON.stringify(res))
this.errorCode = res.errCode
uni.showToast({
icon: 'error',
title: 'errorCode:' + this.errorCode
......
const CURRENT_PAGE_PATH =
'/pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation'
describe('set statusBar color', () => {
if (process.env.uniTestPlatformInfo.startsWith('web')) {
it('dummyTest', async () => {
expect(1).toBe(1)
})
return
}
let page
const adbScreenShotArea = {
x: 880,
y: 0,
width: 60,
height: 60
};
if (process.env.uniTestPlatformInfo.startsWith('android 6')) {
adbScreenShotArea.x = 535
adbScreenShotArea.width = 90
adbScreenShotArea.height = 50
} else if (process.env.uniTestPlatformInfo.startsWith('android 12')) {
adbScreenShotArea.x = 1160
adbScreenShotArea.width = 70
adbScreenShotArea.height = 80
}
beforeAll(async () => {
page = await program.navigateTo(CURRENT_PAGE_PATH)
await page.waitFor(1000)
})
it("setNavigationBarColor1", async () => {
await page.callMethod("setNavigationBarColor1");
const image = await program.screenshot({
adb: true,
area: adbScreenShotArea
});
expect(image).toMatchImageSnapshot();
});
it("setNavigationBarColor2", async () => {
await page.callMethod("setNavigationBarColor2");
const image = await program.screenshot({
adb: true,
area: adbScreenShotArea
});
expect(image).toMatchImageSnapshot();
});
})
<template>
<page-head title="setNavigationBarColor"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarColor1" class="uni-btn">
设置状态栏背景绿色,文字白色
</button>
<button @tap="setNavigationBarColor2" class="uni-btn">
设置状态栏背景红色,文字黑色
</button>
</view>
</template>
<script>
export default {
methods: {
setNavigationBarColor1() {
uni.setNavigationBarColor({
frontColor: "#ffffff",
backgroundColor: "#00ff00",
success: () => {
console.log("setNavigationBarColor success");
},
fail: () => {
console.log("setNavigationBarColor fail");
},
complete: () => {
console.log("setNavigationBarColor complete");
},
});
},
setNavigationBarColor2() {
uni.setNavigationBarColor({
frontColor: "#000000",
backgroundColor: "#ff0000",
success: () => {
console.log("setNavigationBarColor success");
},
fail: () => {
console.log("setNavigationBarColor fail");
},
complete: () => {
console.log("setNavigationBarColor complete");
},
});
},
},
};
</script>
......@@ -7,9 +7,12 @@
<button @tap="setNavigationBarColor2" class="uni-btn">
设置导航条背景红色,标题黑色
</button>
<button @tap="goCustomNavigation" class="uni-btn">
<button @tap="goNavbarLite" class="uni-btn">
跳转自定义导航栏页面
</button>
<button @tap="goCustomNavigation" class="uni-btn">
跳转设置状态栏页面
</button>
</view>
</template>
......@@ -62,10 +65,15 @@
setLifeCycleNum(num : number) {
setLifeCycleNum(num)
},
goCustomNavigation() {
goNavbarLite() {
uni.navigateTo({
url: '/pages/template/navbar-lite/navbar-lite'
})
},
goCustomNavigation(){
uni.navigateTo({
url: '/pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation'
})
}
},
}
......
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 @@
@confirm="confirm_refresher_background_input"></input-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">
<button type="primary" class="button">
list-view 对list-item复用测试
......
......@@ -20,4 +20,12 @@ describe('text-props', () => {
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 @@
<view class="text-box">
<text
>一级节点黑色
<text style="color: red;background-color: yellow;"
<text id="text-nested" ref="text-nested" style="color: red;background-color: yellow;"
>二级节点红色且背景色黄色
<text>三级节点不继承二级的颜色</text>
</text>
......@@ -114,7 +114,12 @@ export default {
singleLineText: 'uni-app x,终极跨平台方案',
}
},
methods: {},
methods: {
// 自动化测试
setTextNested() {
(this.$refs["text-nested"] as UniTextElement).value = "二级节点文字红色且背景色黄色";
}
}
}
</script>
......
## 1.0.6(2024-02-28)
- 更新 Circle 组件名称,防止与内置组件名冲突
## 1.0.5(2024-01-12)
- 优化 删除组件内无用日志输出
## 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 @@
<template v-if="loading">
<slot></slot>
<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>
</template>
<template v-else>
<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>
</view>
</template>
......@@ -20,7 +20,7 @@
</view>
</template>
<script>
import Circle from './circle.uvue'
import LoadingCircle from './loading-circle.uvue'
// TODO 性能问题,其他类型暂时不对外开放
// import Icon from './icon.uvue'
// import UniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.uvue'
......@@ -45,7 +45,7 @@
export default {
name: "uni-loading",
components: { Circle },
components: { LoadingCircle },
props: {
loading: {
type: Boolean,
......
{
"id": "uni-loading",
"displayName": "uni-loading",
"version": "1.0.5",
"version": "1.0.6",
"description": "加载动画组件多用在页面内数据加载时,提供一个loading动画,列表的上拉加载,下拉刷新等都需要加载动画",
"keywords": [
"loading",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册