vuejs3 - Vue3, Vuetify3, Vitest, Teleports not rendering - Stack Overflow

I was having a problem testing my application because vuetify3 uses teleports in their v-menus, v-dialo

I was having a problem testing my application because vuetify3 uses teleports in their v-menus, v-dialogs, v-tooltips, etc. We can disable the teleports by using attach, but that breaks some of our components.

I was having a problem testing my application because vuetify3 uses teleports in their v-menus, v-dialogs, v-tooltips, etc. We can disable the teleports by using attach, but that breaks some of our components.

Share Improve this question edited Mar 11 at 17:41 jesse ekstrom asked Mar 10 at 14:40 jesse ekstromjesse ekstrom 12 bronze badges 3
  • Hi. Don't include the answer in the question. Feel free to answer your own question if you know the answer. The key is that the question and the answer should be in two separate "posts" (can add a answer below with blue "Post Your Answer" button) and make sense on their own, so it can be useful to others as well. It might be even better to cite the source if the solution was obtained from an official GitHub repo, issue, or PR. – rozsazoltan Commented Mar 10 at 14:43
  • attach: string | boolean | Element - Vuetify API Docs - Specifies which DOM element the overlay content should teleport to. Can be a direct element reference, querySelector string, or true to disable teleporting. Uses body by default. --- Conclusion: According to the quoted documentation, this is a correct answer for completely disabling teleportation. – rozsazoltan Commented Mar 10 at 14:48
  • Can I answer my own question? - StackOverflow Help – rozsazoltan Commented Mar 10 at 14:53
Add a comment  | 

1 Answer 1

Reset to default 0

The way I was able to adjust this was to ustilize their "attach='true'" property on those methods within vitest. When setting up my mounts I would have to import vuetify into the global plugins:

const vuetify = createVuetify({
  components,
  directives
})

The trick was to set the defaults for those properties in here:

const vuetify = createVuetify({
  components,
  directives,
  defaults: {
    VTooltip: {
      attach: true,
    }
  }
})

This may not be a good way to get around the teleport problems, but so far it has been working well.

I found a work around to my problem and wanted to share with people

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744840941a4596552.html

相关推荐

  • vuejs3 - Vue3, Vuetify3, Vitest, Teleports not rendering - Stack Overflow

    I was having a problem testing my application because vuetify3 uses teleports in their v-menus, v-dialo

    2天前
    70

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信