ReferenceError: KeyframeEffect is not defined in paper component
ReferenceError: KeyframeEffect is not defined in paper component
我正在构建一个 Web 应用程序,对于下拉列表,我使用 paper-dropdown-menu
我的代码非常简单,并且紧跟演示 here
这是代码片段:
<link rel="import" href="/polymer/polymer-element.html">
<link rel="import" href="/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="/paper-item/paper-icon-item.html">
<link rel="import" href="/paper-listbox/paper-listbox.html">
<link rel="import" href="/iron-icons/maps-icons.html">
<dom-module id="isochrone-settings-element">
<template>
...
<div id="settings">
<paper-dropdown-menu label="Travel mode">
<paper-listbox slot="dropdown-content" attr-for-selected="value" selected={{selectedItem}}>
<paper-icon-item value="auto">
<iron-icon icon="maps:directions-car" slot="item-icon"></iron-icon>Driving
</paper-icon-item >
<paper-icon-item value="bicycle">
<iron-icon icon="maps:directions-bike" slot="item-icon"></iron-icon>Cycling
</paper-icon-item>
<paper-icon-item value="bus">
<iron-icon icon="maps:directions-bus" slot="item-icon"></iron-icon>Bus
</paper-icon-item>
<paper-icon-item value="pedestrian">
<iron-icon icon="maps:directions-walk" slot="item-icon"></iron-icon>Walking
</paper-icon-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</template>
.....
</dom-module>
问题是,当我尝试使用 webapp 中的下拉菜单时,出现以下错误:
neon-animation-runner-behavior.html:40 Couldnt play ( fade-in-animation ). ReferenceError: KeyframeEffect is not defined
at HTMLElement.configure (fade-in-animation.html:39)
at HTMLElement._configureAnimations (neon-animation-runner-behavior.html:33)
at HTMLElement.playAnimation (neon-animation-runner-behavior.html:93)
at HTMLElement._renderOpened (iron-dropdown.html:233)
at HTMLElement.__openedChanged (iron-overlay-behavior.html:541)
at nextAnimationFrame (iron-overlay-behavior.html:566)
每次使用菜单时至少出现 3 次相同的错误。
我现在正在调查组件本身,但由于我没有发现很多在网络上看起来相关的问题,我认为问题可能出在我身上。
这段代码有什么明显的错误吗?
谢谢
您需要为 WebAnimation 添加 polyfill API。您尝试使用的动画仅在 Chrome Canary 中可用。
只需添加:
<link rel="import" href="../../neon-animation/web-animations.html">
The documented line in the source code can be found here.
And here you will receive updates if the need to include this changes
您将需要导入 neo-animation 和 web-animation-js
bower install --save PolymerElements/neon-animation
bower install --save web-animations-js
然后包括以下导入:
<link rel="import" href="../bower_components/neon-animation/web-animations.html">
我正在构建一个 Web 应用程序,对于下拉列表,我使用 paper-dropdown-menu 我的代码非常简单,并且紧跟演示 here
这是代码片段:
<link rel="import" href="/polymer/polymer-element.html">
<link rel="import" href="/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="/paper-item/paper-icon-item.html">
<link rel="import" href="/paper-listbox/paper-listbox.html">
<link rel="import" href="/iron-icons/maps-icons.html">
<dom-module id="isochrone-settings-element">
<template>
...
<div id="settings">
<paper-dropdown-menu label="Travel mode">
<paper-listbox slot="dropdown-content" attr-for-selected="value" selected={{selectedItem}}>
<paper-icon-item value="auto">
<iron-icon icon="maps:directions-car" slot="item-icon"></iron-icon>Driving
</paper-icon-item >
<paper-icon-item value="bicycle">
<iron-icon icon="maps:directions-bike" slot="item-icon"></iron-icon>Cycling
</paper-icon-item>
<paper-icon-item value="bus">
<iron-icon icon="maps:directions-bus" slot="item-icon"></iron-icon>Bus
</paper-icon-item>
<paper-icon-item value="pedestrian">
<iron-icon icon="maps:directions-walk" slot="item-icon"></iron-icon>Walking
</paper-icon-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</template>
.....
</dom-module>
问题是,当我尝试使用 webapp 中的下拉菜单时,出现以下错误:
neon-animation-runner-behavior.html:40 Couldnt play ( fade-in-animation ). ReferenceError: KeyframeEffect is not defined
at HTMLElement.configure (fade-in-animation.html:39)
at HTMLElement._configureAnimations (neon-animation-runner-behavior.html:33)
at HTMLElement.playAnimation (neon-animation-runner-behavior.html:93)
at HTMLElement._renderOpened (iron-dropdown.html:233)
at HTMLElement.__openedChanged (iron-overlay-behavior.html:541)
at nextAnimationFrame (iron-overlay-behavior.html:566)
每次使用菜单时至少出现 3 次相同的错误。
我现在正在调查组件本身,但由于我没有发现很多在网络上看起来相关的问题,我认为问题可能出在我身上。
这段代码有什么明显的错误吗?
谢谢
您需要为 WebAnimation 添加 polyfill API。您尝试使用的动画仅在 Chrome Canary 中可用。 只需添加:
<link rel="import" href="../../neon-animation/web-animations.html">
The documented line in the source code can be found here.
And here you will receive updates if the need to include this changes
您将需要导入 neo-animation 和 web-animation-js
bower install --save PolymerElements/neon-animation
bower install --save web-animations-js
然后包括以下导入:
<link rel="import" href="../bower_components/neon-animation/web-animations.html">