LoginSignup
0
0

More than 5 years have passed since last update.

Vue.js elで指定した要素にはv-directiveは効かない。メモ。

Posted at

あまりこういう使い方はしないかもしれないけど、いちおメモ。

v-directiveが効かなくなる条件

デモ

html
<div id="app">
    <div id="inner" v-if="active"></div>
</div>
javascript
var AppInner = new Vue({
    el: '#inner',
});

var App = new Vue({
    el: '#app',

    data: {
        active: false,
    },
});

この場合、appのdataであるactiveがfalseなので、
inner部分は表示されて欲しくないんだけど、
表示されます。
ということ。

まとめ。

このような使い方をしなければ良いだけですね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0