所以我正在使用 Vue 3,我想使用 Vue Next Select 因为它适用于 vue 3,我遵循此文档:https ://iendeavor.github.io/vue-next-select/#npm-yarn 但在我的 app.js,我执行“从 'vue-next-select' 导入 VueNextSelect”,并且 'vue-next-select' 带有下划线的消息:“模块未导入”
这是我的 package.json 和我的 app.js :
// Import modules...
import {createApp, h} from 'vue';
import {App as InertiaApp, plugin as InertiaPlugin} from '@inertiajs/inertia-vue3';
import {InertiaProgress} from '@inertiajs/progress';
import {createRouter, createWebHistory} from 'vue-router'
import Session from "./Pages/Session";
import Login from "./Pages/Auth/Login";
import Dashboard from "./Pages/Dashboard";
import VueNextSelect from 'vue-next-select'
require('./bootstrap');
window.Vue = require('vue');
const routes = [
{
path: '/',
name: 'login',
component: Login
},
{
path: '/dashboard',
name: 'session',
component: Session,
},
{
path: '/student',
name: 'student',
component: Dashboard,
},
]
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;
const el = document.getElementById('app');
let app = createApp({
render: () =>
h(InertiaApp, {
initialPage: JSON.parse(el.dataset.page),
resolveComponent: (name) => require(`./Pages/${name}`).default,
}),
})
.mixin({methods: {route}})
.use(InertiaPlugin)
app.component("vue-select",VueNextSelect);
app.use(router)
app.mount(el);
InertiaProgress.init({color: '#4B5563'});
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"@inertiajs/inertia": "^0.9.1",
"@inertiajs/inertia-vue3": "^0.4.2",
"@inertiajs/progress": "^0.2.5",
"@tailwindcss/forms": "^0.2.1",
"@tailwindcss/typography": "^0.3.0",
"@vue/compiler-sfc": "^3.0.5",
"axios": "^0.21.1",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"postcss-import": "^12.0.1",
"tailwindcss": "^2.2.4",
"vue": "^3.1.5",
"vue-loader": "^16.1.2"
},
"dependencies": {
"bootstrap": "^5.0.2",
"bootstrap-icons": "^1.5.0",
"bootstrap-vue": "^2.21.2",
"vform": "^2.1.0",
"vue-i18n": "^8.24.5",
"vue-next-select": "^2.9.0",
"vue-router": "^4.0.11"
}
}
所以当我继续我的项目时,我有这个错误:“VueNextSelect is not defined”因为它似乎没有被导入,但我不知道为什么。
欢迎任何帮助或建议,感谢您的时间
编辑:我尝试删除 node_modules 和 package.lock.json 并重新运行 npm install,但仍然相同