B
B
Bogdan2018-02-13 14:19:21
Pug
Bogdan, 2018-02-13 14:19:21

Your own Pug directive and template engine?

Hello. Declared my directive, when using standard HTML in template, everything works fine

<template>
  <div>
    <input v-focus >
  </div>
</template>

but when using Pug, it also works, but it writes an error in the console
<template lang='pug'>
  div
    input( v-focus )
</template>


[Vue warn]: Property or method "focus" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declari...
found in
---> at src\components\App.vue

Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2018-02-13
@k12th

I understand that your custom directive is v-focus. Well, you need to connect it to the component:

import VFocus from './directives/v-focus';

default export {
  directives: {
    VFocus,
  }
}

It is strange, by the way, that this is not in the docks, it used to be.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question