๐
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> | |
<div v-if="apis.hello.pending">Loading</div> | |
<div v-else> | |
<button @click="$api.go('hello')">Hello</button> | |
</div> | |
</div> | |
</template> | |
<script> |
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
this.$form('test').reset() // Reset previous state for form | |
this.$form('test').validate() // Call $touch() + return !$invalid |
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 { Container } from 'apicase' | |
// Declare headers | |
const headers = () => ({ | |
token: localStorage.getItem('token') | |
}) | |
// Declare services | |
const services = { | |
hello: { |
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
export default { | |
forms: { | |
form: { | |
name: { required }, | |
surname: { required }, | |
age: { | |
required, | |
min: value => value >= 18 | |
}, | |
// That one will have a default value |
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
export default { | |
data: () => ({ | |
form: { | |
name: null, | |
surname: null, | |
age: null | |
} | |
}), | |
validations: { | |
form: { |
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 { required, numeric } from 'vuelidate/lib/validators' | |
import { buildFromValidator } from '@/common/utils/forms' | |
const form = { | |
name: { required }, | |
weapon: { required }, | |
price: { numeric }, | |
image: { required }, | |
nested: { | |
item: { required, numeric } |
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 lang="pug"> | |
div.list | |
span {{translate('global.lang')}} | |
label(v-for="lang in available").item | |
input(type="radio",v-model="current",:value="lang") | |
img(:src="icon(lang)",:class="{active: lang === current}") | |
</template> | |
<script> | |
export default { |
NewerOlder