1. Cómo citar URL en reaccionar
1. Uso en componentes
1) Citas en línea:
//1.背景,直接ground
background: 'url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng0ae45ef4c3d867223d942451ca19cf26e065bd93004b717f9f6e58af773ea18f) -74px -43px no-repeat',
//2.img标签src
<img
style={
{
width: '134px',
height: '3px',
margin: '1px 0 14px 124px',
}}
src="https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng3fb56bdddf700e84caec0fbb03b0a8b84af9a004cf78a0f7d1490aa0be6d780b"/>
o
2) referencias locales
import lh from '@/assets/lh.png'
import tlj from '@/assets/tlj.png'
//1.背景,改用backgroundImage
backgroundImage: `url(${
lh})`,
//2.img标签src
<img
style={
{
width: '134px',
height: '3px',
margin: '1px 0 14px 124px',
}}
src={
tjl} />
2. En el archivo css (scss, less, etc.)
El código es el siguiente (ejemplo):
//1.背景,直接ground
background: url('~@/assets/meteorologicalcontrol/kqwdbj.png') no-repeat;
En cuanto al componente img, debido a que src y style pueden no estar juntos, puede referirse directamente a src={tjl} en el componente