提交 4bf32f5e 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(app.use): 补充参数为 null 示例及测试

上级 c636abee
......@@ -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>
......
......@@ -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
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册