code.js 224 B

1234567891011121314151617
  1. const app = new Vue({
  2. el: '#root',
  3. data: {
  4. names: ['Joe', 'Mary', 'Jane', 'Jack'],
  5. newName: '',
  6. },
  7. methods: {
  8. addName() {
  9. this.names.push(this.newName);
  10. this.newName = '';
  11. },
  12. },
  13. });