Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="coba">
- <input class="form-control" v-model="form.npwp" v-validate="'required'" name="npwp" type="text" @input="acceptNumber" required>
- <div v-show="errors.has('npwp')" class="form-control-feedback">{{ errors.first('npwp') }}</div>
- </div>
- methods: {
- acceptNumber() {
- var x = this.form.npwp.replace(/\D/g, '').match(/(\d{0,2})(\d{0,3})(\d{0,3})(\d{0,1})(\d{0,3})(\d{0,3})/)
- this.form.npwp = !x[2] ? x[1] : x[1] + '.' + x[2] +
- (x[3] ? '.' + x[3] + (x[4] ? '.' + x[4] + (x[5] ? '-' + x[5] + (x[6] ? '.' + x[6] : '') : '') : '') : '')
- }
- },
- mounted() {
- let externalScript = document.createElement('script')
- externalScript.setAttribute('src', 'https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js')
- document.head.appendChild(externalScript)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement