search

Home  >  Q&A  >  body text

javascript - How vue dynamically adds instructions to tags (using js to add instructions to tags)

Now that there is an html tag, you need to use js to add instructions to the tag.
It’s like: html: <img />
Then use js to make the html become <img v-lazy='fn'/>

淡淡烟草味淡淡烟草味2781 days ago659

reply all(2)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:27:15

    This method is not recommended in vue. The recommendation is to use state-driven views.

    You can choose v-if tag to achieve this effect.

    <img v-if='imgLazyFlag' v-lazy='fn' />
    <img v-else />

    reply
    0
  • PHPz

    PHPz2017-05-19 10:27:15

    Refer to the official documentation:
    Custom instructions

    reply
    0
  • Cancelreply