<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="grad1" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#1497FC"></stop>
<stop offset="0.5" stop-color="#001122"></stop>
<stop offset="1" stop-color="#ABCDEF"></stop>
</linearGradient>
</defs>
<rect x="100" y="100" fill="url(#grad1)" ></rect>
</svg>
<!-- 线性渐变 -->
我觉得你的代码有问题
1 你没有设置viewBox
2 你没有设置矩形的高宽。