Vue2 examples

https://github.com/san-kumar/vue2-examples

by superasn

HTML

<script src="https://unpkg.com/jquery@3.2.1/dist/jquery.min.js"></script>
<script src="https://unpkg.com/vue@2.5/dist/vue.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/vue2-input/dist/vue2-input.min.js"></script>
<script src="https://unpkg.com/vee-validate/dist/vee-validate.min.js"></script>
<div id="app">
  <div class="card card-body">

    <form @submit.prevent="check('step1')" novalidate>
      <vue2-input type="textarea" rows="3" v-model="value.text" label="Your site name:" placeholder="My site" required min="3" help="(this is a test)" scope="step1"></vue2-input>
      <vue2-input type="email" v-model="value.email" label="Your email:" placeholder="My email" required help="(this is a test)" scope="step1"></vue2-input>

      <vue2-input type="radio" required name="ok" v-model="value.radio" scope="step1"></vue2-input>
      <vue2-input type="checkbox" required :options="[{label: 'one', value: 1},{label: 'two', value: 2},]" v-model="value.checkbox" label="sure?" scope="step1"></vue2-input>
      <vue2-input type="checkbox" required :options="[{label: 'yes', value: true}]" v-model="value.agree" label="agree?" scope="step1"></vue2-input>
      <vue2-input type="select" required :options="[{label: 'one', value: 1},{label: 'two', value: 2},]" v-model="value.select" scope="step1"></vue2-input>

      <div class="card card-body">
        <p>Horizontal</p>

        <vue2-input type="text" horizontal="col-sm-3" v-model="value.text1" label="Your site name 2:" placeholder="My site" required min="3" help="(this is a test)" scope="step1"></vue2-input>
        <vue2-input type="radio" required="" horizontal="col-sm-3" v-model="value.radio1" label="Yes or no?"...

JavaScript

//Initialize as global component
Vue.use(VeeValidate);
Vue.component('vue2-input', Vue2Input.default);

new Vue({
  el: '#app',
  data() {
    return {
      value: {}
    }
  },
  methods: {
    check() {
      this.$validator.validateAll('step1')
        .then((obj) => console.log("result: ", obj))
        .catch((err) => console.log("error: ", err));
    }
  },
});