[Vuejs]-How to use Vue.js in an external js file

0👍

Vue and Jquery not using the same way or idea to creating dynamics element. Jquery using selectors for access the elements, Vue uses templates for making real dynamic elements.
What you are searching for is a vue templating. When the template saved into a file you have to import it to your component, and put into components. Check this vue structure

import Hello form ./folder/another/Hello.vue

...
componets:{
   Hello
}

Also solution when you write small component in script tags. Check it on this example

Example

<template id="create-template">
  ....
</template>

Vue.component('create-post', {
  template: '#create-template'
})

Leave a comment