Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
4bf32f5e
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
376
Star
3
Fork
8
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
4bf32f5e
编写于
7月 26, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(app.use): 补充参数为 null 示例及测试
上级
c636abee
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
5 deletion
+14
-5
components/CompForAppUse.uvue
components/CompForAppUse.uvue
+2
-1
main.uts
main.uts
+7
-1
pages/app-instance/use/use.test.js
pages/app-instance/use/use.test.js
+5
-3
未找到文件。
components/CompForAppUse.uvue
浏览文件 @
4bf32f5e
...
...
@@ -5,7 +5,8 @@
<text class="uni-common-mt plugin2">plugin2: {{ plugin2 }}</text>
<text class="uni-common-mt plugin3">plugin3: {{ plugin3 }}</text>
<text class="uni-common-mt plugin4">plugin4: {{ plugin4 }}</text>
<CompForPlugin />
<CompForPlugin1 />
<CompForPlugin2 />
</view>
</template>
...
...
main.uts
浏览文件 @
4bf32f5e
...
...
@@ -269,7 +269,13 @@ export function createApp() {
app.use(plugin4)
app.use(function (app: VueApp, componentName: string, componentInstance: CreateVueComponent) {
app.component(componentName, componentInstance)
}, 'CompForPlugin', CompForPlugin)
}, 'CompForPlugin1', CompForPlugin)
app.use({
install(app: VueApp, a: string | null, b: string | null) {
app.component('CompForPlugin2', CompForPlugin as CreateVueComponent)
}
}, null, null)
app.config.globalProperties.globalPropertiesStr = 'default string'
app.config.globalProperties.globalPropertiesNum = 0
...
...
pages/app-instance/use/use.test.js
浏览文件 @
4bf32f5e
...
...
@@ -24,9 +24,11 @@ describe('app-instance', () => {
'
plugin4: 通过 definePlugin + 函数方式创建的 plugin
'
)
const
compForPluginEl
=
await
page
.
$
(
'
.component-for-plugin
'
)
const
compForPluginText
=
await
compForPluginEl
.
text
()
expect
(
compForPluginText
).
toBe
(
'
component for plugin
'
)
const
compForPluginEls
=
await
page
.
$$
(
'
.component-for-plugin
'
)
const
compForPlugin1Text
=
await
compForPluginEls
[
0
].
text
()
expect
(
compForPlugin1Text
).
toBe
(
'
component for plugin
'
)
const
compForPlugin2Text
=
await
compForPluginEls
[
1
].
text
()
expect
(
compForPlugin2Text
).
toBe
(
'
component for plugin
'
)
}
it
(
'
app.use options API
'
,
async
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录