avalon
avalon copied to clipboard
ms-html调用svg报错
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,user-scalable=no">
<title>test</title>
</head>
<body ms-controller="test">
<div ms-html="@svg1" style="width:100px;height:100px;position:absolute"></div>
<div ms-html="@svg2" style="width:100px;height:100px;position:absolute;top:200px"></div>
<script src="js/avalon2.js"></script>
</body>
<script>
var vm = avalon.define({
$id:"test",
svg1:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none meet" style="position: absolute; width: 100%; height: 100%;" viewBox="0 0 200 200"><g><g transform="scale(0.1953125, 0.1953125)"><path d="M512 512m-505.429418 0a10 10 0 1 0 1010.858835 0 10 10 0 1 0-1010.858835 0Z" fill="#eb4f38"></path></g></g></svg>',
svg2:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="none meet" style="position: absolute; width: 100%; height: 100%;" viewBox="0 0 200 200"><g><g transform="scale(0.1953125, 0.1953125)"><path d="M512 512m-505.429418 0a10 10 0 1 0 1010.858835 0 10 10 0 1 0-1010.858835 0Z" fill="#eb4f38"></path></g></g></svg>'
});
</script>
</html>
第二个包含 xmlns:xlink="http://www.w3.org/1999/xlink" 字段的svg报错,原因是包含了:号
已经修正