vue.jsの勉強中
vue.jsに見慣れない記法が存在しました。
それこそがcomputed演算子でした。computedは変数や関数自身に
連動して、functionを連鎖的に実行する文法ですが、チェーンのように
一繋がりになっているのは良いことです。しかし
連鎖的にトリガーが入るのは
良いのですが、連鎖反応自体を止める方法が判りません。
computedの連鎖を断ち切る
該当のソースコード
<html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> </head> <body> <div id="app"> <input v-model="writtin" type="text">{{writtin}} <!--<div :nuts="nuts" :second="second" :third="third"></div>--> <script src="https://unpkg.com/vue/dist/vue.js"> </script> <script> new Vue({ el:"#app", data:{ writtin:'', }, computed:{ third:function(){ return this.second }, second:function(){ return this.nuts }, nuts:function(){ return this.writtin } } }) </script> </body> </html>
試したこと
チェーンのルーツにnullを入れたりundefinedを入れて見ましたが、
実行の根本は止めることができませんでした。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/16 00:33 編集
2018/07/16 01:31 編集