expression.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title></title>
  5. <meta charset="utf-8">
  6. <script src="../../../dist/vue.js"></script>
  7. </head>
  8. <body>
  9. <div id="normal">
  10. <p v-text="one + ' ' + two.three + '!'"></p>
  11. <input id="one" v-model="one" name="one"> <input id="two" v-model="two.three" name="two">
  12. <button v-on="click: this.one = 'clicked'">click</button>
  13. </div>
  14. <div id="lazy">
  15. <p v-text="one + ' ' + two.three + '!'"></p>
  16. <form id="form">
  17. <input v-model="one" name="three"> <input v-model="two.three" name="four">
  18. </form>
  19. <button v-on="click: two.three = 'clicked'">click</button>
  20. </div>
  21. <div id="conditional">
  22. <p>{{ok ? yesMsg : noMsg}}</p>
  23. <button v-on="click: ok = !ok" class="toggle">toggle</button>
  24. <button v-on="click: noMsg = 'Nah'" class="change">change</button>
  25. </div>
  26. <div id="attrs" data-test="hi {{msg}} ha"></div>
  27. <script>
  28. Vue.config({debug:true})
  29. var normal = new Vue({
  30. el: '#normal',
  31. data: {
  32. one: 'Hello',
  33. two: {
  34. three: 'World'
  35. }
  36. }
  37. })
  38. var lazy = new Vue({
  39. el: '#lazy',
  40. lazy: true,
  41. data: {
  42. one: 'Hi',
  43. two: {
  44. three: 'Ho'
  45. }
  46. }
  47. })
  48. var conditional = new Vue({
  49. el: '#conditional',
  50. data: {
  51. ok: true,
  52. yesMsg: 'YES',
  53. noMsg: 'NO'
  54. }
  55. })
  56. var attrs = new Vue({
  57. el: '#attrs',
  58. data: {
  59. msg: 'ho'
  60. }
  61. })
  62. </script>
  63. </body>
  64. </html>