counter.js 458 B

123456789101112131415161718192021222324
  1. // NOTE: Make sure to reload the browser with cache disabled after making changes to this file.
  2. export default {
  3. template: `
  4. <button @click="handle_click">
  5. <strong>{{title}}: {{value}}</strong>
  6. </button>`,
  7. data() {
  8. return {
  9. value: 0,
  10. };
  11. },
  12. methods: {
  13. handle_click() {
  14. this.value += 1;
  15. this.$emit("change", this.value);
  16. },
  17. reset() {
  18. this.value = 0;
  19. },
  20. },
  21. props: {
  22. title: String,
  23. },
  24. };