-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Drawer] 在 SFC 内导入 Drawer 组件无法使用 #1022
Comments
👋 @linesoft2,感谢给 TDesign 提出了 issue。 |
将 import statement 改为如下后可用 import { default as TDrawer } from 'tdesign-mobile-vue/es/drawer/drawer'; |
此处有一疑问:独立出: tdesign-mobile-vue/src/drawer/index.ts Line 10 in bfbbdae
Drawer 为何用意
|
在 JS 中建立和控制 Drawer 实例? <template>
<div>
<!-- <t-drawer v-model:visible="visible" :items="baseSidebar" ></t-drawer> -->
<t-button block variant="outline" size="large" theme="primary" @click="visible = true">基础抽屉</t-button>
</div>
</template>
<script setup>
import { ref, watch, watchEffect } from 'vue';
// import { default as TDrawer } from 'tdesign-mobile-vue/es/drawer/drawer';
import { Button as TButton, Drawer } from 'tdesign-mobile-vue';
let visible = ref(false)
const baseSidebar = ref([
{
title: '菜单一',
},
{
title: '菜单二',
},
{
title: '菜单三',
},
{
title: '菜单四',
},
{
title: '菜单五',
},
{
title: '菜单六',
},
]);
const drawer = Drawer({ items: baseSidebar.value, onClose: () => { visible.value = false } })
watchEffect(() => {
if (visible.value) {
drawer.show()
} else {
drawer.hide()
}
})
</script> |
我认为官方可以在使用 Vue 渲染 DrawerPlugin 时抛出错误,如: tdesign-mobile-vue/src/drawer/index.ts Line 21 in bfbbdae
|
如果官方不希望在组件内直接引用 |
tdesign-mobile-vue 版本
1.0.0-rc.6
重现链接
https://1024code.com/codecubes/rc0gauy
重现步骤
在 SFC 中引入
Drawer
,并在template
中使用期望结果
Drawer
正常显示实际结果
Drawer
没有成功被 Vue 识别为组件框架版本
Vue(3.3.4)
浏览器版本
Chromium(116.0.5845.62)
系统版本
Windows 11
Node版本
20.5.0
补充说明
No response
The text was updated successfully, but these errors were encountered: