关于一点点Vue 的使用方法

1.后端返回Map时,如何转成想要的对象数组

/**
 "result": {
            "宠物": "",
            "公益捐赠": "",
            "服饰装扮": "",
            "酒店旅游": "",
            "保险": ""
}
**/
var tempArr = [];
for(var key in result){
    tempArr.push({origin:key,target:result[key]})
} 

2.上传组件 仅支持传excel 和csv格式

关于一点点Vue 的使用方法_第1张图片

 accept=".csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"

3.computed 支持传参????

当我需要把数据 显示成并排的两个表格时~

实现效果:关于一点点Vue 的使用方法_第2张图片

Html 代码 

关于一点点Vue 的使用方法_第3张图片

JavaScript 代码

 computed:{
    leftData(){
      return (category) => {
        return category.filter((_,index)=> index %2 ==0)
      }
      // return [];
      // console.log(vData);
      // return vData.filter((_,index)=> index %2 ==0)
    },
    rightData(){
      return (category) => {
        return category.filter((_,index)=> index %2 ==1)
      }
    }
  },

4.创建定时器 以及清空定时器

//创建定时器 
this.timer = setInterval(() => {
               this.getImportData(numbers)
              }, 5000); 


//清空定时器
if (this.timer) {
        clearInterval(this.timer)
        this.timer = null
      }

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