Created
November 14, 2019 12:35
-
-
Save doey-default/c99acbac2c800976bbbf8592e0e9e793 to your computer and use it in GitHub Desktop.
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="box"> | |
| <div class="field is-grouped"> | |
| <h1 class="subtitle">Simple Storage </h1> | |
| </div> | |
| <div class="field is-grouped"> | |
| <p class="control"> | |
| <a class="button is-info" @click="setter"> | |
| setMessage | |
| </a> | |
| </p> | |
| <p class="control is-expanded"> | |
| <input class="input" type="text" placeholder="string _str" v-model="message"> | |
| </p> | |
| </div> | |
| <div class="field is-grouped"> | |
| <p class="control"> | |
| <a class="button is-info" @click="getter"> | |
| getMessage | |
| </a> | |
| </p> | |
| <p v-if="isFetched"> | |
| {{ fetchedMessage }} | |
| </p> | |
| </div> | |
| </div> | |
| </template> | |
| <script> | |
| import './../node_modules/bulma/css/bulma.css'; | |
| import { setMessage, getMessage } from './SimpleStorage.js' | |
| export default { | |
| data() { | |
| return { | |
| message: '', | |
| fetchedMessage: '', | |
| isFetched: false, | |
| } | |
| }, | |
| methods: { | |
| setter() { | |
| if(this.message.length > 0) { | |
| setMessage(this.message) | |
| this.message = ''; | |
| } | |
| }, | |
| getter() { | |
| this.isFetched = false; | |
| getMessage().then(str => { | |
| this.fetchedMessage = '0: string: ' + str; | |
| this.isFetched = true; | |
| }) | |
| } | |
| }, | |
| } | |
| </script> | |
| <style> | |
| </style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment