1,通过v-on:click绑定事件
2,可以通过<li v-for="(item,index)of list"> </li>
3,在一个标签上 某一个属性跟某一个数据绑定的话 只能使用 v-bind:title="inputvalue"
4,组件如何接受传递过来的值:
在组件上使用 v-bind:index 绑定想要传的值
然后在组件内部通过
app. component( 'todo-item',{
props: ['content', 'index' ],
template: '<li>{{index}} -- {{content}}</li> '}) ;
如何展示 data里面的变量 同时data里面有html的标签
可以使用v-html来实现
```![在这里插入图片描述](https://img-blog.csdnimg.cn/73a48a0c4a27418d92477a667e2e1e7a.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAd2RhZHdhNTY1,size_17,color_FFFFFF,t_70,g_se,x_16#pic_center)
V-once 初次渲染的时候会用 data里面的变量 再次渲染的时候不会发生改变
如何使用动态的v-bind 1,在data里面定义一个变量
2,通过:[] 动态绑定data里面的变量![在这里插入图片描述](https://img-blog.csdnimg.cn/97352dc96f39448f9c9054e528d0b207.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAd2RhZHdhNTY1,size_16,color_FFFFFF,t_70,g_se,x_16#pic_center)
Data&&methods&&computed&&watcher
computed的使用案例
第一![在这里插入图片描述](https://img-blog.csdnimg.cn/5c6a9d2c951f4491928b751c60758093.png#pic_center)
第二![在这里插入图片描述](https://img-blog.csdnimg.cn/024dd05e39954cc5969ae839cf3f437b.png#pic_center)
Vue的基础知识
最新推荐文章于 2024-08-05 18:19:35 发布