Vueの特殊用途

VUEレンダリング終了後にロードされるどのようなデータニーズ1.データ生成されたページまたは変更
Vue.nextTick(関数(){
   警告( 123 );
});

2 VUEメソッド呼び出し

-------------- Vueの追加方法

/ * *
 *時間バインディングタイプをフォーマットするページ
 * FMTフォーマット: 'YYYY-MM-DD HH:MM:SS';
 * / 
Vue.filter( 'のdataFormat'、関数(値、FMT){
     VARのgetDate = 新しい日付(値);
     VAR = O {
         'M +':getDate.getMonth()+ 1  D '+' :getDate.getDate( )、
         'H +' :getDate.getHours()、
         'M +' :getDate.getMinutes()、
         'S +' :getDate.getSeconds()、
         Q '+':Math.floor((getDate.getMonth()+ 3)/ 3 )、
         'S' :getDate.getMilliseconds()
    }。
    もし(/(Y +)/ .TEST(FMT)){
        FMT = fmt.replace(正規表現$ 1、(getDate.getFullYear()+ '').SUBSTR(4 - 。正規表現$ 1 .LENGTH))
    }
    VAR K O){
         場合新しい正規表現( '(' + K + ')' ).TEST(FMT)){
            FMT = fmt.replace(正規表現$ 1、(正規表現$ 1.length === 1)([K] O):。。?(( '00' + O [K])SUBSTR(( '' +。[K O ])。長さ)))
        }
    }
    リターンのfmt;
});

そこ VM = 新しいヴュー({
    上: '#app' 
    データ:{
        日付:新しい日付();
    }、
    方法:{
        AAA:関数(){
     // メソッドを呼び出す 
            options.filters VM $ [ 'のdataFormat'](vm.date、 'YYYYMM'。 )。       
        }
    }
}) 


または方法Vueのページを呼び出します


<P> {{日付| dataFormat( 'YYYYMM')}} </ P>                            

 

おすすめ

転載: www.cnblogs.com/junzhu-bye/p/12405311.html