child.vue 475 B

1234567891011121314151617181920212223242526
  1. <template>
  2. <div>
  3. <button @click="$emit('countChange', counte++)">emit value</button>
  4. <div>from parent: {{passToChild}} </div>
  5. <div>from parent to computed: {{computedFromProps}} </div>
  6. </div>
  7. </template>
  8. <script>
  9. export default {
  10. name: "child",
  11. props: {
  12. passToChild: String
  13. },
  14. data() {
  15. return {
  16. counte: 0
  17. };
  18. },
  19. computed: {
  20. computedFromProps: function() {
  21. return "computed: " + this.passToChild;
  22. }
  23. }
  24. };
  25. </script>