William B
William B

Reputation: 53

Conditional tag ending </div> in Vue.js

I'm trying to do a conditional tag ending, but this isn't working. Is there a work around?

    <div class="container">

    <template v-if="smallScreen"> 
         </div>
    </template>

    <template v-else> 
         </div>
    </template>

Thanks! William

Upvotes: 2

Views: 1714

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85565

I can understand why you require this kind of situation. But alas, there's no such a way to fulfill this situation to be solved as of now with Vue.js.

You must coverage them with a wrapper:

<div class="container" v-if="smallScreen">
  <template></template>
</div>
<div class="container" v-else>
  <template>Another Template</template>
</div>

Upvotes: 2

Related Questions