Skip to content

Instantly share code, notes, and snippets.

@ErikCH
Created July 3, 2019 03:53
Show Gist options
  • Select an option

  • Save ErikCH/1c8f75908fe4e530273a88c5b0fb9fe7 to your computer and use it in GitHub Desktop.

Select an option

Save ErikCH/1c8f75908fe4e530273a88c5b0fb9fe7 to your computer and use it in GitHub Desktop.
Function File for new Vue Function API
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