Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
04cc769b
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5956
Star
89
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
04cc769b
编写于
5月 10, 2024
作者:
zhaofengliang920817
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of gitcode.net:dcloud/hello-uni-app-x into dev
上级
c035e42d
b7f74f92
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
601 addition
and
64 deletion
+601
-64
pages.json
pages.json
+54
-4
pages/API/compress-image/compress-image.uvue
pages/API/compress-image/compress-image.uvue
+134
-0
pages/API/get-app-base-info/get-app-base-info.test.js
pages/API/get-app-base-info/get-app-base-info.test.js
+21
-1
pages/API/get-current-pages/get-current-pages.test.js
pages/API/get-current-pages/get-current-pages.test.js
+4
-1
pages/API/get-current-pages/get-current-pages.uvue
pages/API/get-current-pages/get-current-pages.uvue
+3
-1
pages/API/get-image-info/get-image-info.uvue
pages/API/get-image-info/get-image-info.uvue
+85
-0
pages/API/get-system-info/get-system-info.test.js
pages/API/get-system-info/get-system-info.test.js
+21
-1
pages/API/get-video-info/get-video-info.uvue
pages/API/get-video-info/get-video-info.uvue
+57
-0
pages/API/resize-observer/resize-observer.test.js
pages/API/resize-observer/resize-observer.test.js
+4
-1
pages/API/resize-observer/resize-observer.uvue
pages/API/resize-observer/resize-observer.uvue
+4
-4
pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue
...ave-image-to-photos-album/save-image-to-photos-album.uvue
+15
-2
pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue
...ave-video-to-photos-album/save-video-to-photos-album.uvue
+67
-0
pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.test.js
...roundColorContent/set-page-backgroundColorContent.test.js
+6
-1
pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.uvue
...ckgroundColorContent/set-page-backgroundColorContent.uvue
+5
-1
pages/API/unicloud-database/unicloud-database.test.js
pages/API/unicloud-database/unicloud-database.test.js
+3
-0
pages/API/unicloud-database/unicloud-database.uvue
pages/API/unicloud-database/unicloud-database.uvue
+35
-0
pages/CSS/transform/translate.uvue
pages/CSS/transform/translate.uvue
+1
-1
pages/component/list-view/list-view-multiplex.uvue
pages/component/list-view/list-view-multiplex.uvue
+1
-1
pages/component/sticky-header/sticky-header.uvue
pages/component/sticky-header/sticky-header.uvue
+1
-1
pages/component/sticky-section/sticky-section.test.js
pages/component/sticky-section/sticky-section.test.js
+2
-1
pages/component/sticky-section/sticky-section.uvue
pages/component/sticky-section/sticky-section.uvue
+14
-9
pages/component/textarea/textarea.uvue
pages/component/textarea/textarea.uvue
+32
-32
pages/tabBar/API.uvue
pages/tabBar/API.uvue
+32
-2
未找到文件。
pages.json
浏览文件 @
04cc769b
...
...
@@ -618,6 +618,54 @@
"navigationBarTitleText"
:
"图片"
}
},
//
#ifdef
APP-ANDROID
{
"path"
:
"pages/API/get-image-info/get-image-info"
,
"style"
:
{
"navigationBarTitleText"
:
"获取图片信息"
}
},
{
"path"
:
"pages/API/compress-image/compress-image"
,
"style"
:
{
"navigationBarTitleText"
:
"压缩图片"
}
},
//
#endif
//
#ifdef
APP
//
{
//
"path"
:
"pages/API/choose-video/choose-video"
,
//
"style"
:
//
{
//
"navigationBarTitleText"
:
"拍摄视频或从相册中选择视频"
//
}
//
},
{
"path"
:
"pages/API/save-video-to-photos-album/save-video-to-photos-album"
,
"style"
:
{
"navigationBarTitleText"
:
"保存视频到相册"
}
},
//
#endif
//
#ifdef
APP-ANDROID
{
"path"
:
"pages/API/get-video-info/get-video-info"
,
"style"
:
{
"navigationBarTitleText"
:
"获取视频信息"
}
},
//
{
//
"path"
:
"pages/API/compress-video/compress-video"
,
//
"style"
:
//
{
//
"navigationBarTitleText"
:
"压缩视频"
//
}
//
},
//
#endif
{
"path"
:
"pages/API/get-network-type/get-network-type"
,
"style"
:
{
...
...
@@ -1236,6 +1284,7 @@
"navigationBarTitleText"
:
"nested-scroll-body"
}
},
//
#ifdef
APP
||
WEB
{
"path"
:
"pages/API/request-payment/request-payment"
,
"style"
:
{
...
...
@@ -1280,6 +1329,7 @@
"backgroundColor"
:
"#F8F8F8"
}
},
//
#endif
{
"path"
:
"pages/template/custom-long-list/custom-long-list"
,
"style"
:
{
...
...
@@ -1302,13 +1352,13 @@
"navigationBarTitleText"
:
""
,
"backgroundColorContent"
:
"#fffae8"
}
}
//
#ifdef
APP-ANDROID
,
{
}
,
//
#ifdef
APP-ANDROID
||
WEB
{
"path"
:
"pages/API/resize-observer/resize-observer"
,
"style"
:
{
"navigationBarTitleText"
:
"resize
0
bserver"
"navigationBarTitleText"
:
"resize
o
bserver"
}
},
//
#endif
...
...
pages/API/compress-image/compress-image.uvue
0 → 100644
浏览文件 @
04cc769b
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view class="image-container">
<image class="image" :src="beforeCompressPath" mode="aspectFit"></image>
<image class="image" :src="afterCompressPath" mode="aspectFit"></image>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">压缩前图片信息</text>
</view>
<text>{{beforeCompressImageInfo}}</text>
<view class="uni-title">
<text class="uni-subtitle-text">压缩后图片信息</text>
</view>
<text>{{afterCompressImageInfo}}</text>
<view class="uni-btn-v">
<button type="primary" @click="chooseImage">从相册中选取待压缩的图片</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="compressImage">压缩图片</button>
</view>
</view>
<input-data defaultValue="80" title="压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)" type="number"
@confirm="onQualityInputConfirm"></input-data>
<input-data title="压缩后图片的宽度,单位px" type="number" @confirm="onCompressedWidthInputConfirm"></input-data>
<input-data title="压缩后图片的高度,单位px" type="number" @confirm="onCompressedHeightInputConfirm"></input-data>
<input-data defaultValue="auto" title="压缩后图片的宽度,支持px、%、auto" type="string"
@confirm="onWidthInputConfirm"></input-data>
<input-data defaultValue="auto" title="压缩后图片的高度,支持px、%、auto" type="string"
@confirm="onHeightInputConfirm"></input-data>
<input-data defaultValue="0" title="旋转度数,范围0~360" type="number" @confirm="onRotateInputConfirm"></input-data>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
title: "compressImage",
beforeCompressImageInfo: "",
afterCompressImageInfo: "",
beforeCompressPath: "",
afterCompressPath: "",
quality: 80,
compressedWidth: null as number | null,
compressedHeight: null as number | null,
width: "auto",
height: "auto",
rotate: 0
}
},
methods: {
compressImage() {
uni.compressImage({
src: this.beforeCompressPath,
quality: this.quality,
compressedWidth: this.compressedWidth,
compressedHeight: this.compressedHeight,
width: this.width,
height: this.height,
rotate: this.rotate,
success: (_res) => {
this.afterCompressPath = _res.tempFilePath;
uni.showToast({
title: "压缩成功",
icon: null
});
uni.getImageInfo({
src: _res.tempFilePath,
success: (res) => {
this.afterCompressImageInfo = `图片宽度: ${res.width}, 图片高度: ${res.height}`;
}
});
},
fail: (err) => {
uni.showModal({
title: "压缩失败",
content: JSON.stringify(err)
})
}
})
},
chooseImage() {
uni.chooseImage({
count: 1,
sizeType: ["original"],
sourceType: ["album"],
success: (_res) => {
this.beforeCompressPath = _res.tempFilePaths[0];
uni.getImageInfo({
src: _res.tempFilePaths[0],
success: (res) => {
this.beforeCompressImageInfo = `图片宽度: ${res.width}, 图片高度: ${res.height}`;
}
});
}
});
},
onQualityInputConfirm(value : number) {
this.quality = value;
},
onCompressedWidthInputConfirm(value : number) {
this.compressedWidth = value;
},
onCompressedHeightInputConfirm(value : number) {
this.compressedHeight = value;
},
onWidthInputConfirm(value : string) {
this.width = value;
},
onHeightInputConfirm(value : string) {
this.height = value;
},
onRotateInputConfirm(value : number) {
this.rotate = value;
}
}
}
</script>
<style>
.image {
flex: 1;
}
.image-container {
flex-direction: row;
}
</style>
pages/API/get-app-base-info/get-app-base-info.test.js
浏览文件 @
04cc769b
...
...
@@ -10,6 +10,16 @@ describe('ExtApi-GetAppBaseInfo', () => {
]
const
numberProperties
=
[
'
uniCompilerVersionCode
'
,
'
uniRuntimeVersionCode
'
]
const
booleanProperties
=
[
'
isUniAppX
'
]
const
requiredProperties
=
[
'
uniCompilerVersion
'
,
'
uniCompilerVersionCode
'
,
'
uniRuntimeVersion
'
,
'
uniRuntimeVersionCode
'
,
'
isUniAppX
'
]
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -28,6 +38,16 @@ describe('ExtApi-GetAppBaseInfo', () => {
expect
(
value
).
not
.
toBeNull
();
expect
(
value
).
toBeGreaterThanOrEqual
(
3.90
);
}
if
(
booleanProperties
.
indexOf
(
key
)
!=
-
1
)
{
expect
(
value
).
not
.
toBeNull
();
expect
(
typeof
value
).
toBe
(
'
boolean
'
);
}
}
});
});
it
(
'
Check GetSystemInfoSync required properties
'
,
async
()
=>
{
for
(
let
i
=
0
;
i
<
requiredProperties
.
length
;
i
++
)
{
const
key
=
requiredProperties
[
i
]
expect
(
`
${
key
}
not null:
${
res
[
key
]
!=
null
}
`
).
toBe
(
`
${
key
}
not null: true`
)
}
})
});
pages/API/get-current-pages/get-current-pages.test.js
浏览文件 @
04cc769b
...
...
@@ -38,8 +38,11 @@ describe('getCurrentPages', () => {
await
page
.
callMethod
(
'
getPageStyle
'
)
await
page
.
waitFor
(
200
)
const
isEnablePullDownRefresh2
=
(
await
page
.
data
()).
currentPageStyle
.
enablePullDownRefresh
const
data2
=
await
page
.
data
()
const
isEnablePullDownRefresh2
=
data2
.
currentPageStyle
.
enablePullDownRefresh
const
currentPageStyleIsUTSJSONObject2
=
data2
.
currentPageStyleIsUTSJSONObject
expect
(
isEnablePullDownRefresh2
).
toBe
(
false
)
expect
(
currentPageStyleIsUTSJSONObject2
).
toBe
(
true
)
await
page
.
callMethod
(
'
startPullDownRefresh
'
)
await
page
.
waitFor
(
500
)
...
...
pages/API/get-current-pages/get-current-pages.uvue
浏览文件 @
04cc769b
...
...
@@ -33,6 +33,7 @@
checked: false,
pages: [] as Page[],
currentPageStyle: {} as UTSJSONObject,
currentPageStyleIsUTSJSONObject: true,
// TODO
enablePullDownRefreshStatus: true
}
...
...
@@ -65,7 +66,8 @@
getPageStyle() {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
this.currentPageStyle = currentPage.$getPageStyle();
this.currentPageStyle = currentPage.$getPageStyle();
this.currentPageStyleIsUTSJSONObject = this.currentPageStyle instanceof UTSJSONObject
},
setPageStyle(enable : boolean) {
// 目前仅支持 enablePullDownRefresh
...
...
pages/API/get-image-info/get-image-info.uvue
0 → 100644
浏览文件 @
04cc769b
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view class="uni-title">
<text class="uni-subtitle-text">获取本地相对路径图片信息</text>
</view>
<image class="image" :src="relativeImagePath" mode="aspectFit"></image>
<text class="margin-top-10">{{absoluteImageInfo}}</text>
<view class="uni-title">
<text class="uni-subtitle-text">获取网络路径图片信息</text>
</view>
<image class="image" :src="remoteImagePath" mode="aspectFit"></image>
<text class="margin-top-10">{{remoteImageInfo}}</text>
<view class="uni-title">
<text class="uni-subtitle-text">获取本地绝对路径图片信息</text>
</view>
<image class="image" :src="absoluteImagePath" mode="aspectFit"></image>
<text class="margin-top-10">{{relativeImageInfo}}</text>
<view class="uni-btn-v">
<button type="primary" @click="chooseImage">拍摄照片或从相册中选择照片</button>
</view>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
title: "getImageInfo",
relativeImagePath: "/static/test-image/logo.png",
relativeImageInfo: "",
absoluteImagePath: "",
absoluteImageInfo: "",
remoteImagePath: "https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/img/building.jpg",
remoteImageInfo: "",
}
},
methods: {
chooseImage() {
uni.chooseImage({
count: 1,
success: (_res) => {
this.absoluteImagePath = _res.tempFilePaths[0];
uni.getImageInfo({
src: _res.tempFilePaths[0],
success: (res) => {
this.relativeImageInfo = `图片宽度: ${res.width}\n图片高度: ${res.height}\n图片路径: ${res.path}\n图片方向: ${res.orientation}\n图片格式: ${res.type}`;
}
});
}
});
}
},
onReady() {
uni.getImageInfo({
src: this.relativeImagePath,
success: (res) => {
this.absoluteImageInfo = `图片宽度: ${res.width}\n图片高度: ${res.height}\n图片路径: ${res.path}\n图片方向: ${res.orientation}\n图片格式: ${res.type}`;
}
});
uni.getImageInfo({
src: this.remoteImagePath,
success: (res) => {
this.remoteImageInfo = `图片宽度: ${res.width}\n图片高度: ${res.height}\n图片路径: ${res.path}\n图片方向: ${res.orientation}\n图片格式: ${res.type}`;
}
});
}
}
</script>
<style>
.image {
align-self: center;
}
.margin-top-10 {
margin-top: 10px;
}
</style>
pages/API/get-system-info/get-system-info.test.js
浏览文件 @
04cc769b
...
...
@@ -15,6 +15,16 @@ describe('ExtApi-GetSystemInfo', () => {
'
windowWidth
'
,
'
windowHeight
'
,
'
windowTop
'
,
'
windowBottom
'
,
'
screenTop
'
,
'
uniCompilerVersionCode
'
,
'
uniRuntimeVersionCode
'
]
const
booleanProperties
=
[
'
isUniAppX
'
]
const
requiredProperties
=
[
'
uniCompilerVersion
'
,
'
uniCompilerVersionCode
'
,
'
uniRuntimeVersion
'
,
'
uniRuntimeVersionCode
'
,
'
isUniAppX
'
]
beforeAll
(
async
()
=>
{
...
...
@@ -34,6 +44,10 @@ describe('ExtApi-GetSystemInfo', () => {
expect
(
value
).
not
.
toBeNull
();
expect
(
value
).
toBeGreaterThanOrEqual
(
0
);
}
if
(
booleanProperties
.
indexOf
(
key
)
!=
-
1
)
{
expect
(
value
).
not
.
toBeNull
();
expect
(
typeof
value
).
toBe
(
'
boolean
'
);
}
if
(
key
==
'
deviceOrientation
'
)
{
expect
([
'
portrait
'
,
'
landscape
'
]).
toContain
(
value
);
}
...
...
@@ -41,5 +55,11 @@ describe('ExtApi-GetSystemInfo', () => {
expect
([
'
light
'
,
'
dark
'
]).
toContain
(
value
);
}
}
});
});
it
(
'
Check GetSystemInfoSync required properties
'
,
async
()
=>
{
for
(
let
i
=
0
;
i
<
requiredProperties
.
length
;
i
++
)
{
const
key
=
requiredProperties
[
i
]
expect
(
`
${
key
}
not null:
${
res
[
key
]
!=
null
}
`
).
toBe
(
`
${
key
}
not null: true`
)
}
})
});
pages/API/get-video-info/get-video-info.uvue
0 → 100644
浏览文件 @
04cc769b
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view class="uni-title">
<text class="uni-subtitle-text">获取本地绝对路径视频信息</text>
</view>
<video class="video" :src="absoluteVideoPath"></video>
<text class="margin-top-10">{{absoluteVideoInfo}}</text>
<view class="uni-btn-v">
<button type="primary" @click="chooseVideo">拍摄视频或从相册中选择视频</button>
</view>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
title: "getVideoInfo",
absoluteVideoPath: "",
absoluteVideoInfo: "",
}
},
methods: {
chooseVideo() {
uni.chooseVideo({
compressed: false,
success: (_res) => {
this.absoluteVideoPath = _res.tempFilePath;
uni.getVideoInfo({
src: _res.tempFilePath,
success: (res) => {
this.absoluteVideoInfo = `视频画面方向: ${res.orientation}\n视频格式: ${res.type}\n视频长度: ${res.duration}s\n视频大小: ${Math.ceil(res.size / 1024)}kB\n视频宽度: ${res.width}\n视频高度: ${res.height}\n视频帧率: ${res.fps}fps\n视频码率: ${res.bitrate}kbps`;
}
});
}
});
}
}
}
</script>
<style>
.video {
align-self: center;
}
.margin-top-10 {
margin-top: 10px;
}
</style>
pages/API/resize-observer/resize-observer.test.js
浏览文件 @
04cc769b
describe
(
'
api-resize-observer
'
,
()
=>
{
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
)
{
it
(
'
dummyTest
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
...
...
pages/API/resize-observer/resize-observer.uvue
浏览文件 @
04cc769b
...
...
@@ -70,14 +70,14 @@
methods: {
innerBoxClick() {
if (this.innerBoxElement != null) {
this.innerBoxElement!.style.setProperty("width", this.innerBoxElement!.offsetWidth + this.offset)
this.innerBoxElement!.style.setProperty("height", this.innerBoxElement!.offsetWidth + this.offset)
this.innerBoxElement!.style.setProperty("width", this.innerBoxElement!.offsetWidth + this.offset
+ 'px'
)
this.innerBoxElement!.style.setProperty("height", this.innerBoxElement!.offsetWidth + this.offset
+ 'px'
)
}
},
outBoxClick() {
if (this.outBoxElement != null) {
this.outBoxElement!.style.setProperty("width", this.outBoxElement!.offsetWidth + this.offset)
this.outBoxElement!.style.setProperty("height", this.outBoxElement!.offsetWidth + this.offset)
this.outBoxElement!.style.setProperty("width", this.outBoxElement!.offsetWidth + this.offset
+ 'px'
)
this.outBoxElement!.style.setProperty("height", this.outBoxElement!.offsetWidth + this.offset
+ 'px'
)
}
},
revertBoxSize() {
...
...
pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue
浏览文件 @
04cc769b
...
...
@@ -2,8 +2,11 @@
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<image src="/static/uni.png" style="margin: 15px 100px;height:196px;width:196px;"></image>
<button style="margin: 15px;" @click="saveImage">将图片保存到手机相册</button>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<image class="image" src="/static/uni.png"></image>
<button class="margin-top-10" type="primary" @click="saveImage">将图片保存到手机相册</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
...
...
@@ -13,6 +16,7 @@
export default {
data() {
return {
title: "saveImageToPhotosAlbum"
}
},
methods: {
...
...
@@ -39,4 +43,13 @@
</script>
<style>
.margin-top-10 {
margin-top: 10px;
}
.image {
width: 196px;
height: 196px;
align-self: center;
}
</style>
pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue
0 → 100644
浏览文件 @
04cc769b
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<video class="video" :src="src"></video>
<button type="primary" class="margin-top-10" @click="saveVideo">将视频保存到手机相册</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
title: 'saveVideoToPhotosAlbum',
src: ''
}
},
methods: {
saveVideo() {
uni.saveVideoToPhotosAlbum({
filePath: this.src,
success: (_) => {
uni.showToast({
position: "center",
icon: "none",
title: "视频保存成功,请到手机相册查看"
});
},
fail: (e) => {
uni.showModal({
content: "保存相册失败,errCode:" + e.errCode + ",errMsg:" + e.errMsg + ",errSubject:" + e.errSubject,
showCancel: false
});
}
});
}
},
onReady() {
uni.showLoading({
title: '视频下载中'
});
uni.downloadFile({
url: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4',
success: (res) => {
console.log("download video success", res.tempFilePath);
this.src = res.tempFilePath;
uni.hideLoading();
}
});
}
}
</script>
<style>
.video {
align-self: center;
}
.margin-top-10 {
margin-top: 10px;
}
</style>
pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.test.js
浏览文件 @
04cc769b
...
...
@@ -7,7 +7,12 @@ describe('set-page-backgroundColorContent', () => {
it
(
'
check_backgroundColorContent_red
'
,
async
()
=>
{
await
page
.
callMethod
(
'
changeColor
'
,
""
)
page
.
waitFor
(
100
)
page
.
waitFor
(
200
)
const
color
=
(
await
page
.
data
()).
currentBackgroundColorContent
expect
(
color
).
toBe
(
"
red
"
)
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
...
...
pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent.uvue
浏览文件 @
04cc769b
...
...
@@ -8,7 +8,8 @@
export default {
data() {
return {
isChange : false
isChange : false,
currentBackgroundColorContent: "" as any | null
}
},
methods: {
...
...
@@ -17,6 +18,9 @@
let page = pages[pages.length - 1]
page.$setPageStyle({"backgroundColorContent" : this.isChange ? "" : "red"})
this.isChange = !this.isChange
let pageJson = page.$getPageStyle()
this.currentBackgroundColorContent = pageJson["backgroundColorContent"]
}
}
}
...
...
pages/API/unicloud-database/unicloud-database.test.js
浏览文件 @
04cc769b
...
...
@@ -17,6 +17,7 @@ describe('unicloud-database', () => {
await
page
.
callMethod
(
'
dbGetWithCommand
'
)
await
page
.
callMethod
(
'
dbUpdate
'
)
await
page
.
callMethod
(
'
dbRemove
'
)
await
page
.
callMethod
(
'
dbMultiSend
'
)
const
{
addId
,
...
...
@@ -26,6 +27,7 @@ describe('unicloud-database', () => {
getData
,
getWithCommandData
,
removeDeleted
,
multiSendSuccessCount
,
}
=
await
page
.
data
()
expect
(
addId
!==
''
).
toBe
(
true
)
...
...
@@ -35,6 +37,7 @@ describe('unicloud-database', () => {
expect
(
getWithCommandData
.
length
).
toBe
(
1
)
expect
(
updateUpdated
).
toBe
(
3
)
expect
(
removeDeleted
).
toBe
(
3
)
expect
(
multiSendSuccessCount
).
toBe
(
2
)
})
...
...
pages/API/unicloud-database/unicloud-database.uvue
浏览文件 @
04cc769b
...
...
@@ -14,6 +14,7 @@
<button type="primary" @click="dbRemove">删除数据</button>
<button type="primary" @click="dbLookupInit">初始化联表查询数据</button>
<button type="primary" @click="dbLookup">联表查询</button>
<button type="primary" @click="dbMultiSend">合并查询查询</button>
</view>
</view>
</view>
...
...
@@ -35,6 +36,7 @@
getWithCommandData: [] as Array<UTSJSONObject>,
removeDeleted: 0,
lookupData: [] as Array<UTSJSONObject>,
multiSendSuccessCount: 0,
isUniTest: false
}
},
...
...
@@ -278,6 +280,39 @@
const error = err as UniCloudError
this.notify(error.errMsg, '错误')
})
},
dbMultiSend() {
const db = uniCloud.databaseForJQL()
const temp1 = db.collection('type')
.where(
'tag == "default-tag"'
).getTemp()
const temp2 = db.collection('type')
.where(
'tag == "default-tag"'
).getTemp()
db.multiSend(temp1, temp2)
.then<void>(res => {
uni.hideLoading()
let successCount = 0
for (let i = 0; i < res.dataList.length; i++) {
const item = res.dataList[i]
if(item.errCode == 0) {
console.log(`第${i}个请求查询到${item.data!.length}条数据`)
successCount++
} else {
console.error(`第${i}个请求查询失败,错误信息:${item.data!.length}`)
}
}
this.multiSendSuccessCount = successCount
this.notify(`合并查询成功,成功查询的语句条数为:${successCount}`, '提示')
})
.catch<void>((err : any | null) => {
uni.hideLoading()
const error = err as UniCloudError
console.error(err)
this.notify(error.errMsg, '错误')
})
}
}
}
...
...
pages/CSS/transform/translate.uvue
浏览文件 @
04cc769b
...
...
@@ -10,7 +10,7 @@
<text class="reserve-text">转变前位置</text>
</view>
<view class="base reserve">
<text class="reserve-text">translate(-50%,
50%)</text>
<text class="reserve-text">translate(-50%,50%)</text>
<text class="reserve-text">转变前位置</text>
</view>
</view>
...
...
pages/component/list-view/list-view-multiplex.uvue
浏览文件 @
04cc769b
...
...
@@ -7,7 +7,7 @@
<list-view v-show="list_show" id="listview" style="flex: 1;" show-scrollbar=false @scrolltolower="onScrollTolower">
<list-item v-for="index in item_count" class="item" @click="itemClick(index)">
<text >item-------<text>{{index}}</text></text>
<text v-
if
="displayArrow" >item-------<text>{{index}}</text></text>
<text v-
show
="displayArrow" >item-------<text>{{index}}</text></text>
</list-item>
</list-view>
</view>
...
...
pages/component/sticky-header/sticky-header.uvue
浏览文件 @
04cc769b
...
...
@@ -3,7 +3,7 @@
:refresher-enabled="refresher_enabled_boolean" :refresher-triggered="refresher_triggered_boolean"
@refresherrefresh="list_view_refresherrefresh">
<list-item type=1>
<swiper indicator-dots="true" circular="true">
<swiper indicator-dots="true" circular="true"
style="height: 240px;"
>
<swiper-item v-for="i in 3" :item-id="i + ''">
<image src="/static/shuijiao.jpg" style="height: 240px; width: 100%;"></image>
<text style="position: absolute;">{{i}}</text>
...
...
pages/component/sticky-section/sticky-section.test.js
浏览文件 @
04cc769b
...
...
@@ -6,7 +6,8 @@ describe('component-native-sticky-section', () => {
})
//检测吸顶上推效果
it
(
'
check_sticky_section
'
,
async
()
=>
{
it
(
'
check_sticky_section
'
,
async
()
=>
{
page
.
waitFor
(
300
)
await
page
.
callMethod
(
'
listViewScrollByY
'
,
1000
)
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
...
...
pages/component/sticky-section/sticky-section.uvue
浏览文件 @
04cc769b
<template>
<page-head title="sticky-section"></page-head>
<page-head title="sticky-section"></page-head>
<button style="position: fixed; width: 50px; height: 50px;" @click="listViewScrollByY(1000)">测试</button>
<list-view id="list-view" ref="list-view" show-scrollbar=false class="page" :scroll-into-view="scrollIntoView"
@scroll="onScroll" @scrollend="onScrollEnd" rebound="false">
<!-- #ifdef APP -->
@scroll="onScroll" @scrollend="onScrollEnd" rebound="false">
<list-item style="padding: 10px; margin: 5px 0;align-items: center;" :type = 20>
<button @click="gotoStickyHeader('C')" size="mini">跳转到id为C的sticky-header位置上</button>
</list-item>
<!-- #endif -->
</list-item>
<sticky-section v-for="(sectionText) in data" :padding="sectionPadding" :push-pinned-header="true">
<sticky-header :header-id="sectionText" :id="sectionText">
<text class="sticky-header-text">{{sectionText}}</text>
...
...
@@ -40,10 +39,16 @@
//用于自动化测试
listViewScrollByY(y : number) {
const listview = this.$refs["list-view"] as UniElement
listview.scrollBy(0, y)
// listview.scrollBy(0, y)
listview.scrollTop = y
},
gotoStickyHeader(id : string) {
this.scrollIntoView = id
gotoStickyHeader(id : string) {
// #ifdef APP
this.scrollIntoView = id
// #endif
// #ifdef WEB
console.log("web端不支持该功能")
// #endif
},
onScroll() {
this.scrolling = true
...
...
@@ -53,7 +58,7 @@
//滚动后重置scrollIntoView = ""
if(this.scrollIntoView != "") {
this.scrollIntoView = ""
}
}
}
}
}
...
...
pages/component/textarea/textarea.uvue
浏览文件 @
04cc769b
...
...
@@ -90,54 +90,54 @@ export default {
<view class="content">
<boolean-data
:defaultValue="false"
title="键盘弹起时,是否自动上推页面(
仅
限非 Web 平台)"
title="键盘弹起时,是否自动上推页面(限非 Web 平台)"
@change="change_adjust_position_boolean"
></boolean-data>
<boolean-data
:defaultValue="false"
title="是否显示键盘上方带有“完成”按钮那一栏(仅限小程序平台)"
@change="change_show_confirm_bar_boolean"
></boolean-data>
<boolean-data
:defaultValue="false"
title="如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true(仅限小程序平台)"
@change="change_fixed_boolean"
></boolean-data>
<boolean-data
:defaultValue="false"
title="是否自动增高,设置auto-height时,style.height不生效"
@change="change_auto_height_boolean"
></boolean-data>
<boolean-data
:defaultValue="false"
title="点击键盘右下角按钮时是否保持键盘不收起"
@change="change_confirm_hold_boolean"
></boolean-data>
<boolean-data
:defaultValue="focus_boolean"
title="获取焦点"
@change="change_focus_boolean"
></boolean-data>
<boolean-data
:defaultValue="true"
title="首次自动获取焦点"
@change="change_auto_focus_boolean"
></boolean-data>
<boolean-data
:defaultValue="focus_boolean"
title="获取焦点"
@change="change_focus_boolean"
></boolean-data>
<boolean-data
:defaultValue="true"
title="首次自动获取焦点"
@change="change_auto_focus_boolean"
></boolean-data>
<boolean-data
:defaultValue="false"
title="改变光标颜色为透明"
@change="change_cursor_color_boolean"
></boolean-data>
<enum-data
:items="inputmode_enum"
title="是一个枚举属性,它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。(仅限 Web 平台符合条件的高版本浏览器或webview)。"
@change="radio_change_inputmode_enum"
></enum-data>
<enum-data
:items="confirm_type_list"
title="
枚举属性,可以设置键盘右下角按钮。(仅限 Web、iOS 平台)。
"
title="
confirm-type,设置键盘右下角按钮。(Android仅支持return)
"
@change="radio_change_confirm_type"
></enum-data>
<boolean-data
:defaultValue="false"
title="点击软键盘右下角按钮时是否保持键盘不收起(confirm-type为return时必然不收起)"
@change="change_confirm_hold_boolean"
></boolean-data>
<enum-data
:items="inputmode_enum"
title="input-mode,控制软键盘类型。(仅限 Web 平台符合条件的高版本浏览器或webview)。"
@change="radio_change_inputmode_enum"
></enum-data>
<boolean-data
:defaultValue="false"
title="是否显示键盘上方带有“完成”按钮那一栏(仅限小程序平台)"
@change="change_show_confirm_bar_boolean"
></boolean-data>
<boolean-data
:defaultValue="false"
title="如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true(仅限小程序平台)"
@change="change_fixed_boolean"
></boolean-data>
</view>
<!-- #ifdef APP -->
</scroll-view>
...
...
pages/tabBar/API.uvue
浏览文件 @
04cc769b
...
...
@@ -164,7 +164,7 @@
api: ["Element.takeSnapshot"]
},
// #endif
// #ifdef APP-ANDROID
// #ifdef APP-ANDROID
|| WEB
{
name: 'element大小变化监听',
url: 'resize-observer'
...
...
@@ -334,7 +334,7 @@
name: '媒体',
pages: [
{
name: "拍
照和相册选择
",
name: "拍
摄图片或从相册中选择图片
",
url: 'choose-image'
},
{
...
...
@@ -348,6 +348,36 @@
url: 'save-image-to-photos-album'
},
// #endif
// #ifdef APP-ANDROID
{
name: "获取图片信息",
url: 'get-image-info'
},
{
name: "压缩图片",
url: 'compress-image'
},
// #endif
// #ifdef APP
// {
// name: "拍摄视频或从相册中选择视频",
// url: 'choose-video'
// },
{
name: "保存视频到相册",
url: 'save-video-to-photos-album'
},
// #endif
// #ifdef APP-ANDROID
{
name: "获取视频信息",
url: 'get-video-info'
},
// {
// name: "压缩视频",
// url: 'compress-video'
// },
// #endif
/* {
name: "图片选择和拍照",
url: "image",
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录