我正在尝试在我的 vue 2 项目中插入无头 ui popover。我有这个错误
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
},