My component was left with many lines of code, so I decided to put the methods in a separate file called functions.js. I can not call those methods.
I tried this:
functions.js
function sendList() {...};
function getLists() {...};
function deleteList(listId) {...}
export default {sendList, getLists, deleteList}
MyLayout.vue
...
<script>
import {sendList, getLists, deleteList} from '../statics/functions.js'
...
created() { this.getLists();},
...
3 errors appear:
vue.runtime.esm.js?2b0e:587 [Vue warn]: Error in created hook: "TypeError: this.getLists is not a function"
TypeError: this.getLists is not a function
Property or method "lists" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
getLists()
, notthis.getLists()
. – str