D
D
ddnoob2019-09-22 03:41:52
Vue.js
ddnoob, 2019-09-22 03:41:52

How to include a separate .js file in a vue project?

Please explain how to include a separate .js file in the vue project?
Installed vue and vue-router via npm
There is a green.js file
In which file and what should I write in order for the project to accept it?
I tried to add to index.html

<script v-if="green" async defer src="./src/assets/js/green.js"></script>

and in App.vue file
export default {
name: 'App',
green: true
}
But nothing works((
Please explain

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Victor L, 2019-09-22
@ddnoob

not?
import './src/assets/js/green.js'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question