Created
November 11, 2017 19:16
-
-
Save xphong/9fd9c14bdc1a7bc631113835d4cd30fa to your computer and use it in GitHub Desktop.
Marvel API + Vuepack (Vue + Vuex) Blog Post SearchCharacterForm Code
This file contains 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="search-character__form"> | |
<form @submit.prevent | |
@submit="handleSearch()"> | |
<div class="ui action input"> | |
<input v-model="name" | |
placeholder="Character Name" | |
type="text" | |
required /> | |
<button class="ui icon pink button"> | |
<i class="search icon"></i> | |
</button> | |
</div> | |
</form> | |
</div> | |
</template> | |
<script> | |
export default { | |
data: function () { | |
return { | |
name: '' | |
} | |
}, | |
methods: { | |
handleSearch () { | |
this.$store.dispatch('FETCH_CHARACTERS', this.name) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment