expression.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 + 'e' | test}} 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. filters: {
  56. test: function (v) {
  57. return v + 'f'
  58. }
  59. }
  60. })
  61. var html = new Vue({
  62. el: '#html',
  63. data: {
  64. html: '<p>should</p> <a>probably</a>'
  65. }
  66. })
  67. </script>