0

In Vue, how to render to property by condition?

for example I have this markup and by set clickable=true then this div will have :to property if not, will have regular div (no :to).

<div :to="path">
  <img src="..." />
</div>

2 Answers 2

1

Try this:

<div :to="false && path">
  <img src="..." />
</div>
Sign up to request clarification or add additional context in comments.

Comments

0

I think you can use something like this:

   <div v-if="clickable" :to="path">
      <img src="..." />
   </div>
   <div v-else>
      <img src="..." />
   </div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.