Skip to content

Instantly share code, notes, and snippets.

View Kelin2025's full-sized avatar
๐Ÿ‘‹
Let him cook

Anton Kosykh Kelin2025

๐Ÿ‘‹
Let him cook
View GitHub Profile
@Kelin2025
Kelin2025 / example.vue
Last active August 14, 2017 14:21
Vue-apicase example
<template>
<div>
<div v-if="apis.hello.pending">Loading</div>
<div v-else>
<button @click="$api.go('hello')">Hello</button>
</div>
</div>
</template>
<script>
@Kelin2025
Kelin2025 / example.js
Created August 14, 2017 14:17
Vuelidate-forms methods
this.$form('test').reset() // Reset previous state for form
this.$form('test').validate() // Call $touch() + return !$invalid
@Kelin2025
Kelin2025 / example.js
Last active May 8, 2022 04:14
Apicase example
import { Container } from 'apicase'
// Declare headers
const headers = () => ({
token: localStorage.getItem('token')
})
// Declare services
const services = {
hello: {
@Kelin2025
Kelin2025 / example.js
Created August 14, 2017 13:55
Vuelidate-forms demo
export default {
forms: {
form: {
name: { required },
surname: { required },
age: {
required,
min: value => value >= 18
},
// That one will have a default value
@Kelin2025
Kelin2025 / example.js
Last active August 14, 2017 13:54
Problem of vuelidate
export default {
data: () => ({
form: {
name: null,
surname: null,
age: null
}
}),
validations: {
form: {
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 }
@Kelin2025
Kelin2025 / component.vue
Created March 3, 2017 17:12
i18n for Vue.js + Vuex
<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 {