【问题标题】:"TypeError: ranges.clickRange is not a function" when setting a custom range slot for vue2-daterange-picker为 vue2-daterange-picker 设置自定义范围槽时出现“TypeError:ranges.clickRange 不是函数”
【发布时间】:2020-12-09 07:52:12
【问题描述】:

我使用Innologica/vue2-daterange-picker v0.4.3,它在没有范围插槽的情况下工作正常。我想在official documentation 后面加上类似这样的东西(简单地复制粘贴了我们如何使用范围槽):

    <!--    ranges (new slot syntax) -->
    <template #ranges="ranges">
      <div class="ranges">
        <ul>
          <li v-for="(range, name) in ranges.ranges" :key="name" @click="ranges.clickRange(range)">
            <b>{{name}}</b> <small class="text-muted">{{range[0].toDateString()}} - {{range[1].toDateString()}}</small>
          </li>
        </ul>
      </div>
    </template>

我可以看到 UI 的变化,但是当我点击范围时,我得到了这个错误:

[Vue warn]: Error in v-on handler: "TypeError: ranges.clickRange is not a function"

在我的 IDE 中,如果我“cmd+click”clickRange( ) 函数,我可以看到第三方源代码,这意味着该函数存在。

有没有人遇到过类似的问题,你是怎么解决的?

【问题讨论】:

    标签: vuejs-slots vue2-daterange-picker


    【解决方案1】:

    我必须更新到v0.5.1,它现在运行良好!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-05
      • 1970-01-01
      • 2018-03-06
      • 1970-01-01
      • 2021-05-26
      • 2018-10-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多