1.11.1 • Published 7 months ago

vue-confirm-form v1.11.1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 months ago

vue-confirm-form

Vue form component

Installation

npm i -D vue-confirm-form

Example

<template>
    <div>
      <confirm-form :callback="form => myMethod(form)"
                :text="'Show form'"
                :confirm="'Change'"
                :title="'Form'"
                :fields="fields"
                :disabled="disabledFields"
                :default="defaultFields"
                @onChange="onChange"/>
    </div>
</template>
<script>
import ConfirmForm from 'vue-confirm-form'

export default {
  components: {
    ConfirmForm
  },

  data () {
    return {
      fields: {
        text1: '',
        text2: '',
        num: 123,
        checkbox1: { 'title1': 'val1', 'title2': 'val2', 'title3': 'val3' },
        select1: ['option1', 'option2', 'option3', 'option4']
      },

      defaultFields: {
        checkbox1: ['2', '3'],
        select1: 'option2',
        text2: 'Hello'
      },
    
      disabledFields: [
        'text2'
      ]
    }
  },

  methods: {
    myMethod (form) {
      console.log('Form:', form)
    
      if (form.text2 !== 'test') {
        return { field: 'text2', msg: 'Validation failed' }
      }
    },

    onChange (key, val, form) {
      console.log(`Changed '${key}':`, val, form)

      if (key === 'text1') {
        this.text2 = val
      }
    }
  }
}
1.11.1

7 months ago

1.11.0

2 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.9.8

4 years ago

1.9.7

4 years ago

1.9.6

4 years ago

1.9.5

4 years ago

1.9.4

4 years ago

1.9.2

4 years ago

1.9.1

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago