【问题标题】:Retrieving the values ​of an event on 'QMediaPlayer' from Quasar从 Quasar 检索“QMediaPlayer”上的事件值
【发布时间】:2020-11-08 12:48:45
【问题描述】:

我想在我的 QMediaPlayer 组件中尽可能干净地检索事件的 curTimeremaining 值。

我已经测试了几种语法,但都没有成功。

我的代码示例:

this.$root.$on('timeupdate', (curTime, remaining) => {
    console.log('curTime: ', curTime)
    console.log('remaining', remaining)
}))

Quasar Doc

你有什么想法吗?提前致谢

【问题讨论】:

  • 请在代码中显示您的尝试
  • 我添加了我的代码示例,我想通过this.$root.$on
  • 你试过@timeupdate="onTimeUpdate"之类的吗?
  • 不,但这在句法上如何翻译?
  • 这段代码应该是模板中播放器的其他选项之一。当然,您应该使用(curTime, param2) 签名定义方法onTimeUpdate

标签: javascript vue.js quasar


【解决方案1】:

试试这样的@timeupdate="onTimeUpdate":

在模板中

// other component options
@timeupdate="onTimeUpdate"

在代码中:

methods: {
  onTimeUpdate(curTime, remaining) {
    console.log('curTime: ', curTime)
    console.log('remaining', remaining)
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-07
    • 2016-09-27
    • 1970-01-01
    • 2011-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多