您的位置:首页 > 博客中心 > 互联网 >

工作中使用的一些技巧总结【后续持续性更新】

时间:2022-05-08 23:18

  "productStatusList": [
    {
      "dictId": 122,
      "dictName": "启用",
      "dictValue": "1",
      "dictType": "status",
      "dictDescription": "状态",
    },
    {
      "dictId": 123,
      "dictName": "停用",
      "dictValue": "2",
      "dictType": "status",
      "dictDescription": "状态",
    }
  ],

需求: 需要将数字  "dictValue": "2" 转换为对应的汉字状态 "dictName": "停用",

3种情况 : 表格 、 select选择 和 P标签内的。

1、 select选择比较简单。就是循环数组

 

2、 是表格内的。     定义 一个函数 : typeFormat ,然后函数进行处理

  
    
    typeFormat(row, column){
    let obj=this.typeList.find(
    e=>e.dictValue==row.verifyType.toString()
    )
    return obj==null ?"":obj.dictName;
    },

3、P标签内的

  
      {{typeFormat(addForm.productType)}}
    

 

需求: 在表格内增加序号


      

 

需求: 一堆同类的input提交

1、 使用form表单包住全部内容

2、 把form表单内容进行拷贝到params中

  this.$refs.addForm.validate(valid => {
        if (valid) {
          let params = Object.assign({}, this.addForm);
        //请求代码
       
};

 

 

本类排行

今日推荐

热门手游