repeated-vms.html 839 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <div class="item" v-repeat="items" v-component="item" v-ref="items" v-on="click:click">
  2. {{msg + ' ' + title}}
  3. </div>
  4. <script src="../../../dist/vue.js"></script>
  5. <script>
  6. Vue.config({ debug: true })
  7. Vue.component('item', {
  8. ready: function () {
  9. this.title += ' init'
  10. },
  11. methods: {
  12. click: function () {
  13. this.title += ' click'
  14. }
  15. },
  16. data: {
  17. msg: 'msg'
  18. },
  19. computed: {
  20. reversed: function () {
  21. return this.title.split('').reverse().join('')
  22. }
  23. }
  24. })
  25. var app = new Vue({
  26. el: 'body',
  27. data: {
  28. items: [
  29. {title:'a'},
  30. {title:'b'},
  31. {title:'c'}
  32. ]
  33. }
  34. })
  35. </script>