过去,我曾与Velocity一起使用Salesforce Lightning API 39并没有市长问题,因为LockerService已关闭,但由于API版本40已启用,因此Velocity不再起作用。 这是我的代码:
afterScriptsLoaded: function(cmp, event, helper){
var dropdownMenu = cmp.find('dropdown-menu').getElement();
var icon = cmp.find('icon').getElement();
var menu = cmp.find('dropdown').getElement();
// show submenu in desktop
menu.addEventListener('mouseenter', function(e){
if (dropdownMenu.style.display === 'none' && window.matchMedia('screen and (min-width: 768px)').matches) {
Velocity(dropdownMenu, 'slideDown', {duration: 200});
this.classList.add('open');
console.info('open - desktop');
}
});
// hide submenu in desktop
menu.addEventListener('mouseleave', function(e){
if (dropdownMenu.style.display !== 'none' && window.matchMedia('screen and (min-width: 768px)').matches) {
Velocity(dropdownMenu, 'slideUp', {duration: 200});
this.classList.remove('open');
console.info('close - desktop');
}
});
// show/hide submenu in mobile
icon.addEventListener('click', function(e){
if (dropdownMenu.style.display === 'none' && window.matchMedia('screen and (min-width: 768px)').matches == false) {
Velocity(dropdownMenu, 'slideDown', {duration: 200});
menu.classList.add('open');
Velocity(icon,{rotateZ:"180deg"}, {duration: 400, easing: [500,20] });
console.info('open - mobile')
}else if(dropdownMenu.style.display !== 'none' && window.matchMedia('screen and (min-width: 768px)').matches == false){
Velocity(dropdownMenu, 'slideUp', {duration: 200});
Velocity(icon, 'reverse');
menu.classList.remove('open');
console.info('close - mobile')
}
});
}
这是我在控制台中看到的:
速度:第一个参数(SecureElement:[object HTMLUListElement] {键:{“ namespace”:“ c”}}})不是属性映射,已知操作或注册的重定向。正在中止。
有人知道是否可以将Velocity与LockerService结合使用吗?