vuejs / Discussion

Vue.js discussion
167 stars 17 forks source link

Conditional directive #499

Closed apertureless closed 8 years ago

apertureless commented 8 years ago

Hi,

is it possible to set a directive on a condition?

I have a "sticky" directive to make elements sticky on the screen. And I have a social share component where I am using it

<tempalte>
    <div class="social-share" v-sticky>
        ....
    </div>
</template>

However, now I need a condition. I would love making this over a prop.

<social-share :is-sticky="true">

Is there an easy way to add the directive?

apertureless commented 8 years ago

ok got it working over directive params. And added the condition in the directive itself.