I have a form.js stored in my resource/js/
class Form{
constructor(){
//more coding here
}
//more coding here
}
My question is how can I import the file above inside my .vue file? I tried these below:
<template>
//some html here
</template>
<script src="../form.js"></script>
<script>
export default{
data(){
return {
form: new Form({
title: '',
body: ''
})
}
}
}
</script>
But still getting these error:
[Vue warn]: Error in data(): "ReferenceError: Form is not defined"
PROBLEM SOLVED:
export default class Form{
//more coding here
}
import Form from '../form.js';