Sha256: b9df0f3c04865f3b0524240e87c6c56b57518e232df7064e6f571dfe4ce82da2
Contents?: true
Size: 672 Bytes
Versions: 8
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).closest('tr').remove(); }) } } } })
Version data entries
8 entries across 8 versions & 1 rubygems