This is an easy, basic and raw (no styles attached) example of HOW to fetch data from a REST end-point using Vue.js.
Feel free to replace the API with yours or an external one. In any case (also for localhost with other port) remember to enable CORS.
Post-published msg!
I duplicated the original component User; after making slight changes, we have:
- UserWithCallback -> using a
callbackto update in theparentthe selected user. - UserWithEmit -> using a custom event, (aka, emitting) to update in the
parentthe selected user.
Both approaches are valid and produce the same result.
yarn install
yarn serve
yarn build
yarn lint