vue管理系统常用命令记录

保留几位小数

//正则
   let numF = (this.countData.hkje * 100) / 1000000
   sums[index] = Number(numF.toString().match(/^\d+(?:\.\d{0,4})?/)) + '万元';
//计算
   Math.round(this.formData.data.dj* 100) / 100

element的表格插槽,头部label和当前行数据

 <template slot="header">
	<el-tooltip class="item" effect="dark" content="终版预算总成本" placement="top">
	 <span>lable名称span>	
	 el-tooltip>
 template>
<template slot-scope="scope">
    当前行数据 :{{scope.row}}
template>

element的表单校验指定的值

this.$refs.processForm.validateField(`data.wlck.wlckmxList[${index}].dw`);

vue视图不刷新强制刷新

//方法1
   this.$set(this, 'gridData', res.data)
//方法2
   this.$delete(this, 'gridData')
   this.$set(this, 'gridData', res.data)

你可能感兴趣的:(vue.js,javascript,前端)