Created
July 3, 2019 03:53
-
-
Save ErikCH/1c8f75908fe4e530273a88c5b0fb9fe7 to your computer and use it in GitHub Desktop.
Function File for new Vue Function API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Vue from 'vue'; | |
| import { plugin } from 'vue-function-api'; | |
| import { value } from 'vue-function-api'; | |
| Vue.use(plugin); | |
| export const counter = value(0); | |
| export const image = value(''); | |
| export const pressMe = () => { | |
| counter.value++; | |
| console.log(counter.value); | |
| }; | |
| export const getDog = () => { | |
| fetch('https://dog.ceo/api/breeds/image/random') | |
| .then(res => res.json()) | |
| .then(res2 => { | |
| image.value = res2.message; | |
| counter.value++; | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment