async-edge-cases.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <script src="../../../dist/vue.min.js"></script>
  7. </head>
  8. <body>
  9. <script>
  10. // this is necessary to make these cases pass
  11. Vue.config.useEventDelegation = true
  12. </script>
  13. <!-- #4510 click and change event on checkbox -->
  14. <div id="case-1">
  15. <div @click="num++">
  16. {{ num }}
  17. <input type="checkbox" v-model="checked">
  18. </div>
  19. </div>
  20. <script>
  21. var vm1 = new Vue({
  22. el: '#case-1',
  23. data: {
  24. num: 1,
  25. checked: false
  26. }
  27. })
  28. </script>
  29. <!-- #6566 click event bubbling -->
  30. <div id="case-2">
  31. <div class="panel" v-if="expand">
  32. <button @click="expand = false, countA++">Expand is True</button>
  33. </div>
  34. <div class="header" v-if="!expand" @click="expand = true, countB++">
  35. <button>Expand is False</button>
  36. </div>
  37. <div class="count-a">
  38. countA: {{countA}}
  39. </div>
  40. <div class="count-b">
  41. countB: {{countB}}
  42. </div>
  43. </div>
  44. <script>
  45. var vm2 = new Vue({
  46. el: '#case-2',
  47. data: {
  48. expand: true,
  49. countA: 0,
  50. countB: 0,
  51. }
  52. })
  53. </script>
  54. </body>
  55. </html>