项目中常用的书写方式
this.getCurrentAjInfo().then((results) => {
})
typeof (aa) !== 'undefined'
父组件在create中获取接口数据,取到的值放到父组件的data中,如下把data的值传递给子组件
<comHeader :hbfonts="hbfonts" />
子组件接受值
props: [ 'hbfonts'],
<span id="headerspan" v-show="hbfonts==1" class="fd-header-icon-span-3">{{$store.state.session.showName}}</span>
str.replace(/<[^>]+>/g, '')
aa.replace(/\[|]/g,'')
aa.replace(/\"/g, "");
//存在,flag1==0 不存在:flag2==-1
let barginFlag=[1,2,3,4];
let flag1= barginFlag.findIndex(item => item=== a)
<aa-menu v-for="(item, index) in aa" :key="item.key" :code="item.key" :text="`${item.name} `+ ``" @click="handleTriggerClick(item)"></aa-menu>
articleList.slice(0,1)
cd ..
npm run build
修改nginx的conf下的nginx.conf文件,修改端口号,修改代理地址
server {
listen 10022;
server_name localhost;
}
location /aa/ {
proxy_pass http://192.168.33.44:8080;
}
cmd命令查看端口号占用和杀掉占用进程:
>netstat -ano|findstr 10022
>taskkill/f /pid 17680
this.hours = `00${data.getHours()}`.slice(-2)+ ':' + `00${data.getMinutes()}`.slice(-2)
/*最外层透明*/
/deep/ .el-table, /deep/ .el-table__expanded-cell{
background-color: rgba(255,255,255,0.03);
font-size: 14px;
border: 0px;
}
/* 表格内背景颜色 */
/deep/ .el-table th,
/deep/ .el-table tr,
/deep/ .el-table td {
background-color: rgba(255,255,255,0.03);
font-size: 14px;
border: 1px solid rgba(255,255,255,0.16);
}
/deep/ .el-table tr,
/deep/ .el-table td {
color: #ffffff;
}
/deep/ .el-table th{
color: #099cfe;
}
/deep/ .el-table tbody tr:hover > td {
background-color: transparent !important;
}
/deep/ .el-table--enable-row-transition .el-table__body td,
.el-table .cell {
background-color: transparent;
}
<el-cascader @change="cascaderSelectChange" ref="cascaderRef"></el-cascader>
cascaderSelectChange() {
// 自动收到下拉框
this.$refs.cascaderRef.dropDownVisible = false
},
.selectCell .el-cascader-panel .el-cascader-menu:nth-child(3){
.el-radio{
display: none;
}
}
var datas =[
{ value: 188, name: '91-100分' },
{ value: 120, name: '85-90分' },
];
let total = datas.flat().reduce(function (preValue, n) {
return preValue + n.value
}, 0)
transform: translate(-50%, -50%);
flex-wrap: wrap;
window.clearTimeout(this.ds1);
clearInterval(this.timersd)
$ npm install moment --save
在main.js中全局引入
import moment from "moment"
Vue.prototype.$moment = moment;
moment(new Date()).format('YYYY-MM-DD') >= moment(this.form.halfstart).format('YYYY-MM-DD')
parseFloat(0).toFixed(2),
this.xwpjList = this.$store.getters.dictionaryList.filter(item => item.pcode === this.code);
this.xwpjList.sort((a, b) => {
return a.code-b.code
})
let mtsjTemp = Object.assign({},this.aa,this.bb)
let keys = Object.keys(this.aa[0]);
Object.getOwnPropertyNames(mtsjTemp).filter((value)=>{
if(keys.indexOf(value)==-1){
delete mtsjTemp[value];
} else if(['nc','nm','nz'].indexOf(value)!=-1){
mtsjTemp[value] = this.timestampToTime(mtsjTemp[value]);
}
});
this.$router.push({
name: '01FormView',
params: {
_id: this.rowid,
button: 'update',
stage: this.stage,
rybs:this.rybs
}
})
if(this.$route.params.rybs == 0){
res.jzjd = 0
}
父组件
<xwpjForm :formCulumn="formCulumn" ref="pyRules" :formData="this.pyList" />
let pyFlag = this.$refs['pyRules'].validateForm(array);
子组件
<el-form :model="scope.row" ref="xwpjList" :rules="rules" class="demo-ruleForm" style="width:100%">
<el-form-item :prop="items.disabled==true?items.prop:null" style="width:100%" v-if="!items.select">
<el-input :autosize="{ minRows: 1, maxRows: 1}" type="textarea" :disabled="items.disabled ? scope.row[items.disabled] : true" style="width:100%;margin: 5px 0" v-model="scope.row[items.prop]"></el-input>
</el-form-item>
</el-form>
validateForm (array) {
let flag = null
let flagArray =[];
for(var i=0;i<this.$refs['xwpjList'].length;i++){
this.$refs['xwpjList'][i].validate(valid => {
this.defaultSelect(array);
if (valid && this.selectChooseOrNo) {
flagArray.push('true')
} else {
flagArray.push('false')
}
})
}
if(flagArray.indexOf('false')>=0){
flag = false;
} else {
flag = true;
}
return flag
},
timestampToTime(timestamp) {
if(timestamp == null || timestamp == ''){
return "";
}
var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
var D = date.getDate();
return Y+M+D;
},
子组件
<el-button @click="formInsert(scope.$index, formData)" :disabled="chi.disabled ? scope.row[chi.disabled] : true" type="primary" plain >嘿嘿</el-button>
this.$emit('inrBtnClick', index, formData)
父组件
<p2023-formlist :formCulumn="formCulumn" ref="childRules" :formData="form.aa" @inrBtnClick="inrBtnClick"/>
inrBtnClick(index, rows){
// 内容
},