Created
July 3, 2019 03:54
-
-
Save ErikCH/c011599254eeb97314c8fc7d54cdb1cd to your computer and use it in GitHub Desktop.
home component 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
<template> | |
<div class="home"> | |
<h1>Random Dog Images</h1> | |
<h2>Dog Count {{counter}}</h2> | |
<button @click="getDog">Get Dogs</button> | |
<div class="dog-wrapper"> | |
<div class="picture-dog"> | |
<img :src="image" alt /> | |
</div> | |
<button v-on:click="pressMe">Increment Dog Count</button> | |
</div> | |
</div> | |
</template> | |
<script> | |
// @ is an alias to /src | |
import { onCreated, value } from "vue-function-api"; | |
import { getDog, pressMe, counter, image } from "../functions/func"; | |
export default { | |
name: "home", | |
components: {}, | |
setup(props, ctx) { | |
const created = onCreated(() => { | |
getDog(); | |
}); | |
return { | |
pressMe, | |
getDog, | |
counter, | |
image | |
}; | |
} | |
}; | |
</script> | |
<style lang="css"> | |
button { | |
color: blue; | |
background-color: white; | |
border-radius: 10px; | |
font-size: 2rem; | |
border-style: solid; | |
border-color: bisque; | |
box-shadow: inset 0px 1px 0px rgba(75, 166, 255, 0.3); | |
outline: none; | |
} | |
button:hover { | |
text-shadow: 0px 0px 6px rgba(255, 255, 255, 1); | |
transition: all 0.4s ease 0s; | |
-webkit-box-shadow: 0px 5px 40px -10px rgba(0, 0, 0, 0.57); | |
-moz-box-shadow: 0px 5px 40px -10px rgba(0, 0, 0, 0.57); | |
} | |
img { | |
max-width: 30%; | |
padding: 30px; | |
} | |
* { | |
font-family: "Comic Sans MS", "Comic Sans", cursive; | |
} | |
h1 { | |
color: crimson; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment