Dva: 引用 assets 中图片不显示的问题

Created on 28 Jul 2017  ·  2Comments  ·  Source: dvajs/dva

  • 如果是在 css中 定义样式引用本地图片是 可以显示 的:
    .welcome {
    height: 328px;
    background: url(../assets/yay.jpg) no-repeat center 0;
    background-size: 388px 328px;
    }
    \

  • 在js中引用 本地 图片却 不显示
    \

  • 在js中引用 网络上 的图片却 显示
    \

  • 在js中这样引用 本地 图片 不显示 :
    \

    width: '0.44rem',
    height: '0.44rem',
    background: 'url(../assets/account.svg) center center / 0.42rem 0.42rem no-repeat' }}
    /\>

  • 但是如果引用的是 网络上 的图片则 显示
    \

    width: '0.44rem',
    height: '0.44rem',
    background: 'url(https://zos.alipayobjects.com/rmsportal/gjpzzcrPMkhfEqgbYvmN.svg) center center / 0.42rem 0.42rem no-repeat' }}
    /\>

为什么在js中引用本地图片不显示呢,怎么正确引用,谢谢

question

Most helpful comment


svg的不清楚

All 2 comments


svg的不清楚

谢谢,用你给的方式的确可以显示图片了。

那么这种方式能显示本地图片吗:
\

width: '0.44rem',
height: '0.44rem',
background: 'url(https://zos.alipayobjects.com/rmsportal/gjpzzcrPMkhfEqgbYvmN.svg) center center / 0.42rem 0.42rem no-repeat' }}
/\>
这是antd-mobile中给的例子里面的,但是我改成本地的图片却不显示了:
\
width: '0.44rem',
height: '0.44rem',
background: 'url(../../assets/icons/personal_sel.svg) center center / 0.42rem 0.42rem no-repeat' }}
/\>

Was this page helpful?
0 / 5 - 0 ratings