vue动态添加下划线

给li设置样式

li.done {
      text-decoration: line-through;
      color: red;
    }
<li :class="{'done':todo.done}" xxxxxx/>
    todos: [
  { text: '吃饭', done: false },
  { text: '打游戏', done: false },
  { text: '睡觉', done: false }
]
即若todo.done的值为true,li.done样式生效,我觉得还蛮灵活的这种方法
发布了7 篇原创文章 · 获赞 0 · 访问量 1244

猜你喜欢

转载自blog.csdn.net/weixin_32896095/article/details/100569778