Blogger Information
Blog 28
fans 0
comment 0
visits 13020
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
vue中常用的术语与使用方式
手机用户1594223549
Original
835 people have browsed it

1.代码部分

  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>vue常用术语</title>
  8. <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  9. </head>
  10. <body>
  11. <!-- 1. 挂载点(容器/盒子): 应用实例作用域-->
  12. <div id="app">
  13. <!-- 根组件 -->
  14. <p>用户名: {{username}}</p>
  15. </div>
  16. <script>
  17. // 2. 作用实例
  18. const app = Vue.createApp({
  19. // 根组件配制项
  20. data () {
  21. return {
  22. // 将组件中要用到的数据全部声明在这个返回的对象中
  23. username: '王铁蛋',
  24. };
  25. },
  26. });
  27. // 3. 根组件实例: 应用实例与挂载点进行绑定
  28. const vm = app.mount('#app');
  29. // 4. 数据注入: 声明的数据会自动注入到当前应用实例中
  30. // console.log(vm.$data.username);
  31. // 用根组件进行访问
  32. console.log(vm.username);
  33. // 5. 响应式
  34. vm.username = '张铁锤';
  35. // 1. 没有进行dom操作,选择元素,更新内容
  36. // 2. 没有进行事件绑定,这些都是vue在背后默默完成
  37. </script>
  38. </body>
  39. </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