英文:
How to add external JavaScript and swiper.js files to Nuxt 3 (nuxt.config.ts)?
问题
尝试过在nuxt.config.ts中添加外部JavaScript文件,但是Nuxt 3没有加载该文件。CSS文件正常工作,只有脚本文件无法正常工作。进行了大量研究但未找到正确答案,其他人也提出了这个问题,请帮助我,非常感谢。版本 Nuxt 3: 3.4.1
nuxt.config.ts 文件: 图片链接
英文:
I tried to add an external javascript file to nuxt.config.ts but nuxt 3 didn't load the file.But the CSS files work correctly, Only the script files don't work properly, I did a lot of research but I didn't get the right answer, this question is also asked by other people, please help me very much, thank you very much. version Nuxt 3 : 3.4.1
nuxt.config.ts file:[enter image description here](https://i.stack.imgur.com/R5ACH.jpg)
I sent two photos, please see.
答案1
得分: 1
你应该将 Swiper 注册为你的 Nuxt 3 项目的插件。请参阅 https://nuxt.com/docs/guide/directory-structure/plugins
英文:
You should register swiper as a plugin for your Nuxt 3 project. See https://nuxt.com/docs/guide/directory-structure/plugins
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论