admin管理员组文章数量:1426104
I have a vue-cli-3 project, but i'd like to add a static javascript file, but I don't know how import this file.
the traditional way is:
<script src="js/myfile.js"></scrip>
I have a vue-cli-3 project, but i'd like to add a static javascript file, but I don't know how import this file.
the traditional way is:
<script src="js/myfile.js"></scrip>
Share
Improve this question
asked Feb 23, 2019 at 23:55
Jonnathan CarrascoJonnathan Carrasco
1661 silver badge9 bronze badges
2
- Please describe in greater detail what you have tried and what the oute was. – U. Windl Commented Feb 24, 2019 at 1:39
- try in public/index.html – trueChazza Commented Feb 24, 2019 at 11:08
1 Answer
Reset to default 6Place your file (myfile.js) inside your src directory, for example in assets. In your src/App.vue file add in the script portion:
import './assets/myfile.js';
Note that you can technically put your file in public and reference it from your index.html like you usually do. It will work. But it's not the remended approach.
本文标签: vuejsinclude a static javascript on vuecli 3Stack Overflow
版权声明:本文标题:vue.js - include a static javascript on vue-cli 3 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745459869a2659274.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论