Blogger Information
Blog 38
fans 0
comment 0
visits 18526
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
绑定事件练习、组件练习、路由练习
Blackeye
Original
442 people have browsed it

app.vue

  1. <template>
  2. <div>
  3. <router-link to="/">Home</router-link> |
  4. <router-link to="/about">about</router-link>
  5. <br>
  6. <input type="text" v-model="password">
  7. <div v-once>{{password}}</div>
  8. <div>{{password}}</div>
  9. <div v-text="password"></div>
  10. <div v-html="htmlcode"></div>
  11. <div v-pre>{{htmlcode}}</div>
  12. <div :title="btn">按钮</div>
  13. <OneCom></OneCom>
  14. <OneCom><div>Hello wolrd!</div></OneCom>
  15. <OneCom :msg="msg"></OneCom>
  16. <router-view />
  17. </div>
  18. </template>
  19. <style>
  20. </style>
  21. <script>
  22. import OneCom from './components/OneCom.vue';
  23. export default{
  24. data(){
  25. return{
  26. password: "默认密码:123",
  27. htmlcode: "<i>Hi, Dave</i>",
  28. msg:'www.php.cn',
  29. btn: "button"
  30. };
  31. },
  32. methods: {
  33. clicked(){
  34. console.log("hi dave");
  35. },
  36. sayhi(){
  37. console.log("Hahaha");
  38. }
  39. },
  40. components:{
  41. OneCom,
  42. }
  43. }
  44. </script>

OneCom.vue

  1. <template>
  2. <div>
  3. this is one com.
  4. </div>
  5. <div>{{msg}}</div>
  6. <div>{{getmsg()}}</div>
  7. <slot></slot>
  8. </template>
  9. <script>
  10. export default{
  11. props:['msg'],
  12. methods:{
  13. getmsg(){
  14. this.$parent.sayhi();
  15. }
  16. }
  17. }
  18. </script>
  19. <style>
  20. </style>
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!