线性渐变填充:url(/*没有ids*/)

时间:2021-04-19 21:20:47

标签: javascript vue.js svg

你好,我如何使用 linearGradient 但没有 id 填充 svg。例如使用 id 的代码...

<svg class="block__submit">
        <rect fill="url(#linear-gradient-2)" width="100%" height="100%" />
        <text y="50%" x="50%" text-anchor="middle" dominant-baseline="central">
          BUY
        </text>
        <defs>
          <linearGradient id="linear-gradient-2">
            <stop offset="0%" stop-color="#9c83aa" class="stop-start" />
            <stop offset="100%" stop-color="#9c83aa" class="stop-end" />
          </linearGradient>
        </defs>
      </svg>

0 个答案:

没有答案