expression.html 1.6 KB

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