表現

2017-11-29 5 views
0

にこのコードを期待していませんVueの指令を作成します。表現

// template in pug 
#review-step.container 

    .panel(v-test.a) 

// in main.js 
Vue.directive('test', function(el, binding) { 
    console.log(binding.modifiers) 
}) 

は、これらのエラーを与える:

[Vue warn]: Property or method "v" is not defined on the instance but referenced during render. ... 
[Vue warn]: Property or method "test" is not defined on the instance but referenced during render. ... 
TypeError: Cannot read property 'a' of undefined. ... 

私はv-test.a=""にディレクティブを変更した場合、それは正常に動作します。同様に、v-prev-cloak、およびv-onceはすべて正常に動作しますので、テンプレートを誤ってコンパイルすることはありません。 bootstrap-vueから

私は v-preのように、何の表現を期待していないディレクティブを作成する方法を知りたい

v-cloak、またはv-b-modal(ちなみにそのディレクティブは、この同じ問題を抱えているので、私は、本当にここにいる理由です) 。

vue custom directivesのドキュメントには何も表示されず、directive preなどのvueリポジトリを検索しても、vueチームの成果を上げることはできませんでした。

答えて

0

それはパグだった。私は、vueチームが指示に関係なく働く方法を知らないが、pugはmirroring attributesである。

残念ながら、すべてのテンプレートの先頭に宣言しない限り、doctypeオプションをvue webpack loaderに渡す方法を理解する必要があります。