search

Home  >  Q&A  >  body text

javascript - Is there a problem with vue :class?


The code is as shown in the figure. I control the true or false of the selectLessonCtrl data element through the click event, but the select class is not added. Is it a problem with $index?

漂亮男人漂亮男人2755 days ago464

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-19 10:30:32

    Wrong writing, please read the document carefully
    Ternary judgment: :class="[xxx ? 'xxx' : 'xxx']"
    Is there any: :class="{ active: isActive, 'text-danger': hasError }"
    There are other things, it’s best to read the documentation carefully, https://cn.vuejs.org/v2/guide...

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:30:32

    Then selectLessonCtrl returns true?

    reply
    0
  • Cancelreply