Blogger Information
Blog 28
fans 0
comment 0
visits 11650
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
vue的基本术语
子墨吖ฅฅ
Original
627 people have browsed it
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  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. <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  9. </head>
  10. <style>
  11. .active {
  12. color: red;
  13. }
  14. .bgc {
  15. background-color: lightblue;
  16. }
  17. </style>
  18. <body>
  19. <!-- 引入js -->
  20. <!-- 1. 挂载点:应用实例作用域 -->
  21. <div id="app">
  22. <p>{{message}}</p>
  23. <p v-text = "value"></p>
  24. <div v-html="value"></div>
  25. <p v-once="value"></p>
  26. <p v-bind:style="{color:color,backgroundColor:bgc}">行内样式</p>
  27. <!-- v-bind: 高频指令,可以简化, 冒号“:” -->
  28. <!-- v-bind: 通常定义的是html标签中的"预定义"属性 -->
  29. <p :style="{color:color,backgroundColor:bgc}">行内样式</p>
  30. <!-- vue接管class属性 -->
  31. <p :class="[class1,class2]">vue学习</p>
  32. <p :class="{active:isActive,bgc:isBgc}">样式绑定</p>
  33. </div>
  34. <script>
  35. // 2.vue应用实例
  36. const app = Vue.createApp({
  37. // 根组件配置项
  38. data: function () {
  39. // 组件中要用的数据全部都声明在这个返回的对象中
  40. return {
  41. message: 'hello world',
  42. value :'<em style="color:red;">Hello php.cn</em>',
  43. bgc:'skyblue',
  44. color:'red',
  45. class1:'active',
  46. class2:'bgc',
  47. isActive:true,
  48. isBgc :true
  49. }
  50. }
  51. })
  52. // 3.应用实例 与 挂载点 进行绑定
  53. const vm = app.mount('#app')
  54. // 4. 数据注入: 声明的数据会自动注入到当前应用实例中
  55. console.log(vm);
  56. console.log(vm.message);
  57. // 5. 响应式
  58. vm.message = "vue.js"
  59. </script>
  60. </body>
  61. </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