Blogger Information
Blog 26
fans 0
comment 1
visits 10526
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
实例演示vue中常用的术语与使用方式
P粉751989631
Original
310 people have browsed it

实例演示vue中常用的术语与使用方式

  1. <script>
  2. // 2. 应用实例
  3. const app = Vue.createApp({
  4. // 根组件配置项
  5. data: function () {
  6. return {
  7. // 将组件中要用到的数据全部声明在这个返回的对象中
  8. username: "咪咪",
  9. };
  10. },
  11. });
  12. // 3.根组件实例: 应用实例与挂载点进行绑定
  13. const vm = app.mount("#app");
  14. // 4. 数据注入: 声明的数据会自动注入到当前应用实例中
  15. console.log(vm.$data.username);
  16. console.log(vm.username);
  17. const obj = {
  18. $data: {
  19. email: "498668472@qq.com",
  20. },
  21. get email() {
  22. return this.$data.email;
  23. },
  24. set email(email) {},
  25. };
  26. console.log(obj.$data.email);
  27. console.log(obj.email);
  28. // 5. 响应式
  29. vm.username = "小咪咪";
  30. // 1. 我没有进行dom操作,选择元素,更新内容
  31. // 2. 我没有进行事件绑定,这些都是vue在背后默默完成
  32. </script>
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