Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
4dd22a56
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6048
Star
92
Fork
165
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4dd22a56
编写于
11月 26, 2024
作者:
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充wxcomponents组件示例
上级
ab631bd2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
78 addition
and
4 deletion
+78
-4
pages.json
pages.json
+5
-2
pages/tabBar/template.uvue
pages/tabBar/template.uvue
+2
-2
pages/template/vant/vant.test.js
pages/template/vant/vant.test.js
+28
-0
pages/template/vant/vant.uvue
pages/template/vant/vant.uvue
+43
-0
未找到文件。
pages.json
浏览文件 @
4dd22a56
...
...
@@ -2285,12 +2285,15 @@
//
#endif
//
#ifdef
MP
{
"path"
:
"pages/template/vant
-button/vant-button
"
,
"path"
:
"pages/template/vant
/vant
"
,
"style"
:
{
"navigationBarTitleText"
:
"微信自定义组件示例"
,
"usingComponents"
:
{
"van-button"
:
"/wxcomponents/vant/button/index"
"vant-button"
:
"/wxcomponents/vant/button/index"
,
"vant-icon"
:
"/wxcomponents/vant/icon/index"
,
"vant-info"
:
"/wxcomponents/vant/info/index"
,
"vant-loading"
:
"/wxcomponents/vant/loading/index"
}
}
}
...
...
pages/tabBar/template.uvue
浏览文件 @
4dd22a56
...
...
@@ -216,8 +216,8 @@
// #endif
// #ifdef MP
{
id: 'vant
-button
',
url: 'vant
-button
',
id: 'vant',
url: 'vant',
name: '微信自定义组件示例',
open: false,
pages: [] as Page[],
...
...
pages/template/vant
-button/vant-button
.test.js
→
pages/template/vant
/vant
.test.js
浏览文件 @
4dd22a56
jest
.
setTimeout
(
30000
);
describe
(
'
test
title
'
,
()
=>
{
let
page
,
vant
;
describe
(
'
test
vant
'
,
()
=>
{
let
page
,
vantBtnContainer
,
vantBtn
;
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
mp
'
))
{
it
(
'
not support
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
...
...
@@ -8,17 +8,21 @@ describe('test title', () => {
return
}
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/template/vant
-button/vant-button
'
)
page
=
await
program
.
reLaunch
(
'
/pages/template/vant
/vant
'
)
await
page
.
waitFor
(
3000
);
vant
=
await
page
.
$
(
'
van
-button
'
);
vant
BtnContainer
=
await
page
.
$
(
'
vant
-button
'
);
expect
(
await
page
.
data
(
'
jest
'
)).
toBe
(
false
);
});
afterAll
(
async
()
=>
{
expect
(
await
program
.
screenshot
()).
toSaveImageSnapshot
();
});
it
(
'
check title onClick
'
,
async
()
=>
{
const
titleText
=
await
vant
.
text
();
expect
(
titleText
).
toEqual
(
'
vant weapp的van-button按钮组件
'
);
await
vant
.
tap
()
const
titleText
=
await
vantBtnContainer
.
text
();
expect
(
titleText
).
toEqual
(
'
vant weapp的vant-button按钮组件
'
);
vantBtn
=
await
vantBtnContainer
.
$
(
'
button
'
)
await
vantBtn
.
tap
()
await
page
.
waitFor
(
1000
);
console
.
log
(
'
jest
'
,
await
page
.
data
(
'
jest
'
))
//
expect(await page.data('jest')).toBe(true);
console
.
log
(
'
jest
'
,
await
page
.
data
(
'
jest
'
))
expect
(
await
page
.
data
(
'
jest
'
)).
toBe
(
true
);
});
});
pages/template/vant
-button/vant-button
.uvue
→
pages/template/vant
/vant
.uvue
浏览文件 @
4dd22a56
<template>
<view>
<view
style="align-items: center;"
>
<page-head title="微信小程序自定义组件示例"></page-head>
<view class="uni-list-cell-padding">
<text>
uni-app-x支持在微信小程序端引入微信小程序自定义组件。以下以vant weapp组件为例演示
</text>
</view>
<view style="text-align: center;">
<van-button type="primary" @click="onClick">vant weapp的van-button按钮组件</van-button>
</view>
<text class="uni-list-cell-padding">
uni-app-x支持在微信小程序端引入微信小程序自定义组件。以下以vant weapp组件为例演示
</text>
<text class="uni-common-mt uni-title-text uni-common-mb">vant-button组件</text>
<vant-button color="#55aa00" @click="onClick">vant weapp的vant-button按钮组件</vant-button>
<text class="uni-common-mt uni-title-text uni-common-mb">vant-icon组件</text>
<vant-icon name="balance-list" size="30" color="#aa55ff"></vant-icon>
<text class="uni-common-mt uni-title-text uni-common-mb">vant-info组件</text>
<vant-info info="99"></vant-info>
<text class="uni-common-mt uni-title-text uni-common-mb">vant-loading组件</text>
<vant-loading color="#00aaff"></vant-loading>
</view>
</template>
<script>
export default {
data() {
return {
// 自动化测试
jest: false
};
},
...
...
@@ -31,7 +35,9 @@
}
}
</script>
<style>
.van-info {
right: 200px !important;
top: 370px !important;
}
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录