is like this, every page needs to call some api,. If you write request, on each page, it will feel cumbersome. Is there a good way to write it as a common module, and then introduce a module?
is like this, every page needs to call some api,. If you write request, on each page, it will feel cumbersome. Is there a good way to write it as a common module, and then introduce a module?
export default axios.get('/commonApi').then(data => {
return data.data
})
import commonApi from './commonApi'
...
mounted() {
commonApi.then(data => console.log(data))
}
Previous: Vue-router dynamic routing lazy loading slow local hot updates
Next: How does PHP realize that the array key name is unchanged and the values are interchangeable?