Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
56b159de
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5994
Star
90
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看板
提交
56b159de
编写于
12月 19, 2023
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修正不跨平台的用法
上级
192f66b9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
119 addition
and
106 deletion
+119
-106
components/uni-navbar-lite/uni-navbar-lite.uvue
components/uni-navbar-lite/uni-navbar-lite.uvue
+2
-2
pages/API/navigator/new-page/new-page-1.uvue
pages/API/navigator/new-page/new-page-1.uvue
+2
-2
pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.uvue
...navigation-bar-color/set-custom-navigation-bar-color.uvue
+1
-1
pages/API/storage/storage.uvue
pages/API/storage/storage.uvue
+1
-1
pages/component/form/form.uvue
pages/component/form/form.uvue
+3
-3
pages/component/image/image-format.uvue
pages/component/image/image-format.uvue
+89
-88
pages/component/image/image-path.uvue
pages/component/image/image-path.uvue
+11
-4
pages/component/video/video-format.uvue
pages/component/video/video-format.uvue
+4
-5
pages/template/list-news/list-news.test.js
pages/template/list-news/list-news.test.js
+6
-0
未找到文件。
components/uni-navbar-lite/uni-navbar-lite.uvue
浏览文件 @
56b159de
...
...
@@ -44,8 +44,8 @@
created() {
uni.loadFontFace({
global: false,
family: 'UniIconsFontFamily',
source:
iconpath,
family: 'UniIconsFontFamily',
source:
"url(" + iconpath + ")",
success() { },
fail(err) {
console.log(err);
...
...
pages/API/navigator/new-page/new-page-1.uvue
浏览文件 @
56b159de
...
...
@@ -19,8 +19,8 @@ export default {
}
},
onLoad(options: OnLoadOptions) {
if (options
.has('data')
) {
this.data = options
.get('data')!
if (options
['data'] != null
) {
this.data = options
['data']
}
},
methods: {
...
...
pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.uvue
浏览文件 @
56b159de
...
...
@@ -36,7 +36,7 @@ export default {
onShow(){
uni.loadFontFace({
family: 'UniFontFamily',
source: '
static/font/uni.ttf
'
source: '
url(static/font/uni.ttf)
'
})
},
methods: {
...
...
pages/API/storage/storage.uvue
浏览文件 @
56b159de
...
...
@@ -31,7 +31,7 @@
type="text"
placeholder="请输入value"
name="data"
:value="
data
"
:value="
typeof data === 'string' ? data : JSON.stringify(data)
"
@input="dataChange"
/>
</view>
...
...
pages/component/form/form.uvue
浏览文件 @
56b159de
...
...
@@ -11,10 +11,10 @@
<view class="title">性别</view>
<radio-group name="gender" class="flex-row">
<view class="group-item">
<radio :value="
0
" :checked="gender=='0'" /><text>男</text>
<radio :value="
'0'
" :checked="gender=='0'" /><text>男</text>
</view>
<view class="group-item">
<radio :value="
1
" :checked="gender=='1'" /><text>女</text>
<radio :value="
'1'
" :checked="gender=='1'" /><text>女</text>
</view>
</radio-group>
</view>
...
...
@@ -31,7 +31,7 @@
</view>
<view class="uni-form-item">
<view class="title">年龄</view>
<slider name="age" :value="age" :show-value="true"></slider>
<slider name="age" :value="age
+ ''
" :show-value="true"></slider>
</view>
<view class="uni-form-item">
<view class="title">保留选项</view>
...
...
pages/component/image/image-format.uvue
浏览文件 @
56b159de
<template>
<scroll-view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title">
<text class="uni-title-text">支持的图片格式示例</text>
</view>
<view v-for="(item,index) in supportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix" :src="item.src"></image>
</view>
</view>
<view class="uni-title">
<text class="uni-title-text">暂不支持的格式</text>
</view>
<view v-for="(item,index) in notSupportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix" :src="item.src" @error="imageErrorEvent"></image>
</view>
</view>
</view>
</scroll-view>
<scroll-view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title">
<text class="uni-title-text">支持的图片格式示例</text>
</view>
<view v-for="(item,index) in supportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix" :src="item.src"></image>
</view>
</view>
<view class="uni-title">
<text class="uni-title-text">暂不支持的格式</text>
</view>
<view v-for="(item,index) in notSupportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix" :src="item.errorImage == null ? item.src : item.errorImage"
@error="imageErrorEvent(index, $event as ImageErrorEvent)"></image>
</view>
</view>
</view>
</scroll-view>
</template>
<script>
export default {
data() {
return {
title: 'image-format',
supportFormats: [
{
format: 'bmp',
src: '/static/test-image/logo.bmp'
},
{
format: 'gif',
src: '/static/test-image/logo.gif'
},
{
format: 'ico',
src: '/static/test-image/logo.ico'
},
{
format: 'jpg',
src: '/static/test-image/logo.jpg'
},
{
format: 'png',
src: '/static/test-image/logo.png'
},
{
format: 'webp',
src: '/static/test-image/logo.webp'
},
{
format: 'heic(Android10+支持)',
src: '/static/test-image/logo.heic'
}
] as Array<ImageFormat>,
notSupportFormats: [
{
format: 'avif',
src: '/static/test-image/logo.avif'
},
{
format: 'tif',
src: '/static/test-image/logo.tif'
}
] as Array<ImageFormat>
}
},
methods: {
imageErrorEvent(e
: ImageErrorEvent) {
console.log("图片加载错误", e.detail); //TODO tif打不出正确的错误日志
// 图片加载失败,加载本地占位图
e.target?.setAttribute('src', '/static/template/drop-card/dislike.png')
}
},
}
type ImageFormat = {
format : string
src : string
}
export default {
data() {
return {
title: 'image-format',
supportFormats: [
{
format: 'bmp',
src: '/static/test-image/logo.bmp'
},
{
format: 'gif',
src: '/static/test-image/logo.gif'
},
{
format: 'ico',
src: '/static/test-image/logo.ico'
},
{
format: 'jpg',
src: '/static/test-image/logo.jpg'
},
{
format: 'png',
src: '/static/test-image/logo.png'
},
{
format: 'webp',
src: '/static/test-image/logo.webp'
},
{
format: 'heic(Android10+支持)',
src: '/static/test-image/logo.heic'
}
] as Array<ImageFormat>,
notSupportFormats: [
{
format: 'avif',
src: '/static/test-image/logo.avif'
},
{
format: 'tif',
src: '/static/test-image/logo.tif'
}
] as Array<ImageFormat>
}
},
methods: {
imageErrorEvent(index: number, e
: ImageErrorEvent) {
console.log("图片加载错误", e.detail); //TODO tif打不出正确的错误日志
// 图片加载失败,加载本地占位图
this.notSupportFormats[index].errorImage = '/static/template/drop-card/dislike.png'
}
},
}
type ImageFormat = {
format : string
src : string
errorImage ?: string | null
}
</script>
<style>
.image {
margin: 40rpx auto;
width: 200rpx;
}
</style>
\ No newline at end of file
.image {
margin: 40rpx auto;
width: 200rpx;
}
</style>
pages/component/image/image-path.uvue
浏览文件 @
56b159de
...
...
@@ -8,13 +8,13 @@
<view v-for="(item,index) in data" :key="index">
<text class="uni-subtitle-text">{{item.description}}</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix" :src="item.
src" @error="imageErrorEvent
"></image>
<image class="image" mode="widthFix" :src="item.
errorImage == null ? item.src : item.errorImage" @error="imageErrorEvent(index, $event as ImageErrorEvent)
"></image>
</view>
</view>
<view>
<text class="uni-subtitle-text">非static目录的src静态路径:./logo.png</text>
<view class="uni-center" style="background:#FFFFFF;">
<image class="image" mode="widthFix"
src="./logo.png" @error="image
ErrorEvent"></image>
<image class="image" mode="widthFix"
:src="outsideStaticErrorPath == null ? outsideStaticPath : outsideStaticErrorPath" @error="imageOutsideStatic
ErrorEvent"></image>
</view>
</view>
</view>
...
...
@@ -27,6 +27,8 @@
data() {
return {
title: 'image-path',
outsideStaticPath: './logo.png',
outsideStaticErrorPath: null as string | null,
data: [
{
src: '/static/test-image/logo.png',
...
...
@@ -91,16 +93,21 @@
}
},
methods: {
imageErrorEvent(e : ImageErrorEvent) {
imageErrorEvent(
index: number,
e : ImageErrorEvent) {
console.log("图片加载错误", e.detail);
// 图片加载失败,加载本地占位图
e.target?.setAttribute('src', '/static/template/drop-card/dislike.png')
this.data[index].errorImage = '/static/template/drop-card/dislike.png'
},
imageOutsideStaticErrorEvent(e: ImageErrorEvent) {
console.log("图片加载错误", e.detail);
this.outsideStaticErrorPath = '/static/template/drop-card/dislike.png'
}
},
}
type ImagePath = {
src : string
errorImage ?: string | null
description : string
}
</script>
...
...
pages/component/video/video-format.uvue
浏览文件 @
56b159de
...
...
@@ -8,7 +8,7 @@
<view v-for="(item,index) in supportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}</text>
<video :id="'video-' + item.format" class="video" :src="item.src" :controls="true" :direction="-90"
@error="onError"></video>
@error="onError
(item.format, $event as VideoErrorEvent)
"></video>
</view>
<view class="uni-title">
<text class="uni-title-text">暂不支持的格式</text>
...
...
@@ -78,10 +78,9 @@
}
},
methods: {
onError: function (e : VideoErrorEvent) {
const id = e.target?.getAttribute("id");
console.log(id + ":" + e.detail);
if (id != "video-错误路径") {
onError: function (format: string, e : VideoErrorEvent) {
console.log(format + ":" + e.detail);
if (format != "video-错误路径") {
this.isError = true;
}
}
...
...
pages/template/list-news/list-news.test.js
浏览文件 @
56b159de
// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
template-list-news
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
it
(
'
dummyTest
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/template/list-news/list-news
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录