Javascript Velocity:第一个参数不是属性映射

Javascript Velocity:第一个参数不是属性映射,javascript,typescript,velocity.js,Javascript,Typescript,Velocity.js,我正在使用Velocity制作一些动画(没有jQuery),我遇到了一个问题,出现了以下错误: Velocity:第一个参数([object HtmlDiscovery])不是属性映射、已知操作或注册的重定向。流产 我看了其他的例子,它们似乎和我做的一样,它们也能起作用。为什么我的坏了 当我转储rev.elem的值时,我得到一个htmldevelment Velocity(rev.elem, 'slideUp', { duration: 225, queue: false,

我正在使用Velocity制作一些动画(没有jQuery),我遇到了一个问题,出现了以下错误:

Velocity:第一个参数([object HtmlDiscovery])不是属性映射、已知操作或注册的重定向。流产

我看了其他的例子,它们似乎和我做的一样,它们也能起作用。为什么我的坏了

当我转储
rev.elem
的值时,我得到一个
htmldevelment

Velocity(rev.elem, 'slideUp', {
    duration: 225,
    queue: false,
    easing: 'easeInOutQuad'
});
这家伙似乎也是这么用的,而且对他很有效:
我有

该示例基于Jason Weaver的原始示例,但已更新为最新版本的Velocity,并修复了帕格语法错误

  var el = document.querySelector(element), // cache click target
    con = document.querySelector(container), // cache container target
    up = 'slideUp', // store up command
    down = 'slideDown'; // store down command

  el.addEventListener('click', function(event) {

    var active = el.classList.contains('active'); // store active state
    el.classList.toggle('active'); // toggle click target active

    Velocity(con, active ? up : down, { // test and init command
      duration: duration, // duration set in function call params
      easing: easing // easing set in function call params
    });

    event.preventDefault();

});
我有

该示例基于Jason Weaver的原始示例,但已更新为最新版本的Velocity,并修复了帕格语法错误

  var el = document.querySelector(element), // cache click target
    con = document.querySelector(container), // cache container target
    up = 'slideUp', // store up command
    down = 'slideDown'; // store down command

  el.addEventListener('click', function(event) {

    var active = el.classList.contains('active'); // store active state
    el.classList.toggle('active'); // toggle click target active

    Velocity(con, active ? up : down, { // test and init command
      duration: duration, // duration set in function call params
      easing: easing // easing set in function call params
    });

    event.preventDefault();

});

我通过导入velocity和velocity ui使其正常工作:

<script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.js"></script>
<script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.ui.min.js"></script>
从“速度动画”导入速度;

导入“velocity动画/velocity.ui”我通过导入velocity和velocity ui使其工作:

<script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.js"></script>
<script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.ui.min.js"></script>
从“速度动画”导入速度;

导入“velocity动画/velocity.ui”如果您使用的是beta Velocity V2,那么这还不起作用-为了支持可扩展API,我删除了这样的快捷方式-我现在正在处理序列,并将在序列出现时返回此答案(在接下来的几周内).

如果您使用的是beta Velocity V2,那么这还不起作用-为了支持可扩展API,我删除了这样的快捷方式-我现在正在处理序列,并将在序列出现时(在接下来的几周内)返回此答案。

您需要导入“Velocity”和“Velocity ui”:


您需要同时导入“velocity”和“velocity ui”: