搜尋

首頁  >  問答  >  主體

javascript - less中background:url問題

background: url(${@http}/img/icon/daorug@2x.png) no-repeat center 3rem / auto 25%;

@http是變數
這樣書寫會不現實,也沒有解析!

請問該怎麼辦?

ringa_leeringa_lee2866 天前651

全部回覆(2)我來回復

  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:32:55

    找到答案了 應該是background: url('@{http}/img/icon/daorug@2x.png') no-repeat center 3rem / auto 25%;

    回覆
    0
  • 为情所困

    为情所困2017-05-19 10:32:55

    呼叫方式錯了,不用那個美元符號

    @http: http://www.yoursite.com;   // 对变量@http的定义, 习惯上写在less文件开头
    
    background: url(@http/img/icon/daorug@2x.png) no-repeat center 3rem / auto 25%;

    回覆
    0
  • 取消回覆