將SVG與AngularJS一起使用時,遇到了一個奇怪的行為。我正在使用該$routeProvider服務(wù)配置我的路線。當我將這個簡單的SVG放在模板中時,一切都很好:<div id="my-template"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <rect fill="red" height="200" width="300" /> </svg> // ...</div>但是,當我添加一個過濾器時,例如以下代碼:<div id="my-template"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <filter id="blurred"> <feGaussianBlur stdDeviation="5"/> </filter> </defs> <rect style="filter:url(#blurred)" fill="red" height="200" width="300" /> </svg></div>然后:它可以在我的主頁上運行。使用Firefox時,SVG 在其他頁面上不再可見,但仍然留有空間。使用Chrome時,SVG是可見的,但根本不會模糊。當我手動(使用Firebug)刪除filter樣式時,SVG再次可見。這是路由配置:$routeProvider .when('/site/other-page/', { templateUrl : 'view/Site/OtherPage.html', controller : 'Site.OtherPage' }) .when('/', { templateUrl : 'view/Site/Home.html', controller : 'Site.Home' }) .otherwise({ redirectTo : '/' });Fiddle請注意,盡管Chrome可在Firefox中“運行”,但我無法在Fiddle中重現(xiàn)該問題。我試圖用來創(chuàng)建我的整個SVG都無濟于事document.createElementNS()。有人對發(fā)生的事情有想法嗎?
- 3 回答
- 0 關(guān)注
- 423 瀏覽
添加回答
舉報
0/150
提交
取消