Reputation: 7145
My use case is something like this.
<p>
element which's id is "demo".<p>
element through v-if
and if the value inside that element equals to the "EXPIRED" then I want to remove the disabled
attribute in my button.
Future explaining my use case, I want to initially disabled my button and when the status updated to EXPIRED in that paragraph I want remove that disabled part from my button.
How to I achieve this using
<template lang="html">
<div class="">
<p id="demo"></p>
<button type="button" name="button" class="btn btn-primary" disabled>Start</button>
</div>
</template>
Upvotes: 3
Views: 11752
Reputation: 56720
If you are setting this EXPIRED stuff using non-Vue DOM manipulation you are lost. Don't mix that with Vue. Instead I would do this:
<template lang="html">
<div class="">
<p id="demo">{{ status }}</p>
<button type="button" name="button" class="btn btn-primary" :disabled="status !== 'EXPIRED'">Start</button>
</div>
</template>
status
being a property of your VM in the data()
function.
Upvotes: 8