gpt4 book ai didi

vue.js - 无法将 tailwind headless ui 与 vue 2 一起使用。对象(...)不是函数

转载 作者:行者123 更新时间:2023-12-05 09:04:29 27 4
gpt4 key购买 nike

我正在尝试在我的 vue 2 项目中插入 headless ui 弹出窗口。我有这个错误

Uncaught TypeError: Object(...) is not a function
at eval (headlessui.esm.js?d511:670)
at Module../node_modules/@headlessui/vue/dist/headlessui.esm.js (chunk-vendors.js:23)
at __webpack_require__ (app.js:849)
at fn (app.js:151)
at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/Navigations/Navbar.vue?vue&type=script&lang=js&:5)
at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/Navigations/Navbar.vue?vue&type=script&lang=js& (app.js:998)
at __webpack_require__ (app.js:849)
at fn (app.js:151)
at eval (Navbar.vue?7538:1)
at Module../src/components/Navigations/Navbar.vue?vue&type=script&lang=js& (app.js:2161)

我的代码看起来像这样。

  <div v-if="isLoggedIn" class="flex space-x-2">
<NotificationCenter />
<Popover class="relative">
<PopoverButton>Solutions</PopoverButton>

<PopoverPanel class="absolute z-10">
<div class="grid grid-cols-2">
<a href="/analytics">Analytics</a>
<a href="/engagement">Engagement</a>
<a href="/security">Security</a>
<a href="/integrations">Integrations</a>
</div>
</PopoverPanel>
</Popover>
</div>

在脚本中我已经像往常一样导入并添加了组件。

import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue'
export default {
name: "Home",
components: {
MenuButton,
UserStats,
NotificationCenter,
Popover, PopoverButton, PopoverPanel
},

最佳答案

查看文档

“请注意,此库仅支持 Vue 3。”

https://headlessui.dev/vue/popover

关于vue.js - 无法将 tailwind headless ui 与 vue 2 一起使用。对象(...)不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68559374/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com