You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <title>{{ title }}</title>
  5. <script src="js/vue.js"></script>
  6. </head>
  7. <body>
  8. <!--gv-start-->
  9. <div>
  10. <div>{{title1}}</div>
  11. <div>{{title2}}</div>
  12. <assssss>{{title2}}</assssss>
  13. <div>{{title3}}</div>
  14. <a href="#" @click="click">{{title3}}</a>
  15. <div id="app-4">
  16. <ol>
  17. <li v-for="todo in todos">
  18. <a href="#" @click="click(todo.text)"> {{ todo.text }}</a>
  19. </li>
  20. </ol>
  21. </div>
  22. <input v-model="message" placeholder="edit me">
  23. <textarea v-model="message" placeholder="add multiple lines"></textarea>
  24. <p>Original message: "{{ message }}"</p>
  25. <p>Computed reversed message: "{{ reversedMessage }}"</p>
  26. <input type="checkbox" id="jack" value="Jack" v-model="checkedNames">
  27. <label for="jack">Jack</label>
  28. <input type="checkbox" id="john" value="John" v-model="checkedNames">
  29. <label for="john">John</label>
  30. <input type="checkbox" id="mike" value="Mike" v-model="checkedNames">
  31. <label for="mike">Mike</label>
  32. <br>
  33. <span>Checked names: {{ checkedNames }}</span>
  34. <div id="example-4">
  35. <input type="radio" id="one" value="One" v-model="picked">
  36. <label for="one">One</label>
  37. <br>
  38. <input type="radio" id="two" value="Two" v-model="picked">
  39. <label for="two">Two</label>
  40. <br>
  41. <span>Picked: {{ picked }}</span>
  42. </div>
  43. <select v-model="selected">
  44. <option v-for="option in options" v-bind:value="option.value">
  45. {{ option.text }}
  46. </option>
  47. </select>
  48. <span>Selected: {{ selected }}</span>
  49. </div>
  50. <!--gv-end-->
  51. </body>
  52. <script src="js/govue.js"></script>
  53. <script gv-src>
  54. var app = new Vue({
  55. data: {
  56. message: 'Hello',
  57. title1: "123",
  58. title2: "456",
  59. title3: "789",
  60. todos: [
  61. {text: '学习 JavaScript'},
  62. {text: '学习 Vue'},
  63. {text: '整个牛项目'},
  64. {text: '{{a}}'}
  65. ],
  66. checkedNames: [],
  67. picked: '',
  68. selected: 'A',
  69. options: [
  70. {text: 'One', value: 'A'},
  71. {text: 'Two', value: 'B'},
  72. {text: 'Three', value: 'C'}
  73. ]
  74. },
  75. computed: {
  76. // 计算属性的 getter
  77. reversedMessage: function () {
  78. // `this` 指向 vm 实例
  79. return this.message.split('').reverse().join('')
  80. }
  81. },
  82. methods: {
  83. click: function (a) {
  84. alert("点击触发:" + a);
  85. },
  86. },
  87. });
  88. GoVueMount(app, {
  89. title: "123"
  90. }, "body > div")
  91. </script>
  92. </html>