Blogger Information
Blog 62
fans 3
comment 1
visits 29738
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
vue的基础用法
kiraseo_wwwkiraercom
Original
375 people have browsed it

vue的基础用法

代码如下

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <!-- vue.js -->
  9. <script src="https://unpkg.com/vue@next"></script>
  10. <style>
  11. .ys { color: blue;}
  12. .bgc{background: lawngreen;}
  13. </style>
  14. </head>
  15. <body>
  16. <div class="app">
  17. <fieldset>
  18. 基本信息<br/>
  19. <span>用户名:</span>{{username}}<br/>
  20. <span>学号:</span>{{number}}<br/>
  21. </fieldset>
  22. <!-- 使用v-text,v-html, -->
  23. <span>使用v-text写法</span>
  24. <p>用户名:<span v-text="username"></span></p>
  25. <span>使用v-html写法</span>
  26. <p>测试:<span v-html="test"></span></p>
  27. <span>使用v-bind写法</span>
  28. <p :class="[color, bgc]">测试:<span v-html="test"></span></p>
  29. <span>使用v-model写法</span>
  30. <p>
  31. <input type="text" v-model.lazy="comment" />
  32. <span>{{comment}}</span>
  33. </p>
  34. </div>
  35. </body>
  36. <script>
  37. const app = Vue.createApp({
  38. data() {
  39. return {
  40. username: 'kiraseo',
  41. number:'61952',
  42. test:'<i>这是斜体</i>',
  43. color:'ys',
  44. bgc:'bgc',
  45. comment:' ',
  46. };
  47. },
  48. }).mount('.app');
  49. </script>
  50. </html>

演示效果图

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post