定义全局的方法,例如定义过滤器,在很多地方都会用到,就可以定义在minxin中
demo:
数据格式化 保留指定的小数位数
var mixin={
filters:{
fixedNum:function(value,point){
return value.toFixed(point)
}
}
};
new Vue(
el:'#app',
router,
mixin,
template:'<App/>',
components:{App}
);
定义全局的方法,例如定义过滤器,在很多地方都会用到,就可以定义在minxin中
demo:
数据格式化 保留指定的小数位数
var mixin={
filters:{
fixedNum:function(value,point){
return value.toFixed(point)
}
}
};
new Vue(
el:'#app',
router,
mixin,
template:'<App/>',
components:{App}
);
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。