I use Quasar framework There is a component for displaying an article

<template> </template> <style> </style> <script> export default { name: 'Post', data () { return { data: {} } }, methods: { get () { } } } </script> 

I need to make it so that the get () method is called automatically when the component is loaded. How to do it?

  • Like the standard hook, it works on quasar. But not sure. - Idushii

1 answer 1

 <template> </template> <style> </style> <script> export default { name: 'Post', data () { return { data: {} } }, methods: { get () { } }, mounted() { this.get(); } } </script> 

Try calling the method in the mounted hook. Here is the documentation - https://ru.vuejs.org/v2/api/#mounted