Questions tagged [vue-directives]

A Vue.js directive can only appear in the form of a prefixed HTML attribute that takes the following format:

<element
  prefix-directiveId="[argument:] expression [| filters...]">
</element>

Common directives are v-if , v-for, v-model...

218 questions
2
votes
1 answer

Vue access 'on' and 'class' directives from directive

I want to group multiple directives in a custom directive like the following with model: const model = Vue.directive('model') Vue.directive('custom', { bind(el, binding, vnode, oldVnode) { // do custom directive stuff // modify…
Simon Kirsten
  • 2,542
  • 18
  • 21
2
votes
2 answers

How to execute a function from another component using vuejs2

I have a component thats need to colling a event when my sidebar opens and I need to call this function every time that I need to open my sidebar. Here is a example: I click in a elemnt the elemnt open my sidebar and mysiderbar calls a function that…
João Fagner
  • 119
  • 1
  • 3
  • 12
2
votes
2 answers

v-for on the same level with v-if affects v-else

If I do this:
  • {‌{ morevalue }} {‌{ value }}
The span in v-else will also be looped ON THE SECOND V-FOR…
2
votes
3 answers

Using vuejs without the domain specific language for the directives

I’m currently evaluating vuejs and I like it a lot except for the use of a domain specific language used for the directives in the html templates. Is it (at least theoretically) possible use vuejs without the dns and specify the information in the…
doberkofler
  • 9,511
  • 18
  • 74
  • 126
2
votes
2 answers

Math.random().toString.slice is not a function in Javascript

I'm trying to set up a custom directive on Vue JS 2. But I got this error message: TypeError: Math.random(...).toString.slice is not a function Here is my directive written globally on main.js: Vue.directive('rainbow', { bind (el, binding, vnode)…
BeeLee
  • 183
  • 5
  • 15
2
votes
1 answer

is it possible to use directive intercepting vue from render the template

Is it possible to use directive preventing vue from render the template? For example
{{ variable }}
will show {{ variable }}, but not the value of variable ---update--- Actually, I was prepared to do some operations…
GuessEver
  • 71
  • 1
  • 4
2
votes
2 answers

VueJs directive two way binding

I created a custom directive to handle select2 in VueJs. The code below works when I am binding a select to a data property in my viewmodel that is not a propert of an object within data. Like this.userId but if it is bound to something like…
secretAgentB
  • 1,279
  • 4
  • 19
  • 36
2
votes
3 answers

v-else-if not working in vuejs : Failed to resolve directive: else-if

I am using "if" and "else-if" but is giving me compilation error. [Vue warn]: Failed to resolve directive: else-if this is my code var app = new Vue({ el:"#app", data:{ lab_status : 2 } });
devendra
  • 21
  • 1
  • 1
  • 3
2
votes
1 answer

How to disable an input box by clicking a button using vue js 2.0

How can I disable an input box via clicking a button and toggling it using vuejs 2.0
radeveloper
  • 926
  • 2
  • 12
  • 20
1
vote
4 answers

Passing value of style directive to button component in Vuejs

I want to add padding to the :style directive of my shared button component but for some reasons, the changes aren't showing up on the button. I tried doing it with 3 ways below to apply the changes but none of them worked. I'm new to Vuejs and not…
1
vote
1 answer

Passing style directive value to a component in Vuejs

I am trying to add padding to a shared button component through :style directive. For some reasons, the changes doesn't show up on the button. This shared component requires different padding based on different scenario so I cannot add it directly…
1
vote
1 answer

how to use dropdown box to filter the display/hide div element in vue js

I am new to VueJS and trying to create a simple dropdown box to filter the display/hide of div but encounter some problems.