Sha256: 68653f32fb90400614edbddf0ed87bdda9764c835a5d5bfb6a240aee9d42b4be
Contents?: true
Size: 672 Bytes
Versions: 20
Compression:
Stored size: 672 Bytes
Contents
import Vue from 'vue'; import $ from 'jquery'; export default Vue.component('repeater-field', { props: { rowCount: { type: Number } }, data: function() { return { rows: [] } }, created: function() { if (this.rowCount === 0) { this.addRow(); } }, methods: { addRow: function() { this.rows.push({ id: Math.uid() }); }, removeRow: function(row) { this.rows.$remove(row); } }, directives: { removeRow: { bind: function() { $(this.el).on('click', function(e) { e.preventDefault(); $(this).parents('tr').remove(); }) } } } })
Version data entries
20 entries across 20 versions & 1 rubygems