el-button 自定义背景图片

 

 

<el-button circle plain :style="iconStyle(1)" @click="details(sc.row)"></el-button>






import vIcon from "@/assets/img/icon_view.png";



iconStyle(t) {
      let s = "width: 42px;height: 42px;align-items: center";
      if (t == 1) {
        return "backgroundImage:url(" + vIcon + ");margin:0px 16px 0px 0px;" + s;
      } else if (t == 2) {
        return "backgroundImage:url(" + dIcon + ");margin:0 auto;" + s;
      }
    }

 

posted @ 2022-04-07 20:37  AngDH  阅读(1503)  评论(0编辑  收藏  举报