Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
406 views
in Technique[技术] by (71.8m points)

Microsoft Edge下,在vue中使用svg,改变fill渲染出错

在vue中使用了svg点击后可以改变颜色,在其他浏览器都ok,但是在IE(edge)下改变颜色后,位置出错

<svg>
  <g>
    <text :fill="data.fill" x="50%" y="50%"></text>
  </g>
</svg>

本来应该是这样的

clipboard.png

结果改变颜色后在ie下就变为这个样子了

clipboard.png

demo:http://codepen.io/WangXiZhu/p...

不知道大家有没有遇到过。抱歉之前没有说清楚


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

即使不点击 "Click Me" 按钮,仅双击一下 SVG 的文字,也会变成只剩一半内容。

应该是 Edge 的 bug,可以向微软提 bug。

无 Vue 的 html 文件:

<html class="">

<head>
  <meta charset="UTF-8">
  <meta name="robots" content="noindex">
  <style class="cp-pen-styles">
  body {
    font-size: 18px;
  }
  
  #svg-icon {
    display: block;
    margin: 0 auto;
  }
  </style>
</head>

<body>
  <title>Edge vue svg test</title>
  <div id="app">
    <svg id="svg-icon" width="8.4em" height="2.2em" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 315 70" version="1.1">
      <g>
        <text id="RECOMMEND" x="50%" y="50%" text-anchor="middle" font-size="46" font-weight="normal" fill="#000">
          RECOMMEND
        </text>
      </g>
    </svg>
  </div>
</body>

</html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...