vue-timers icon indicating copy to clipboard operation
vue-timers copied to clipboard

[Vue warn]: Invalid value for option "timers": expected an Object, but got Array.

Open Zhangzijing opened this issue 5 years ago • 3 comments

mycode:

<template>
</template>

<script>

import { timer } from 'vue-timers'
 
export default {
  timers: [
    timer('log', 1000)
  ],
  methods: {
    log () {
      console.log('It works!')
    }
  }
}
</script>

Zhangzijing avatar Oct 10 '19 15:10 Zhangzijing

main.js:


import VueTimers from 'vue-timers' 
Vue.use(VueTimers)

Zhangzijing avatar Oct 10 '19 16:10 Zhangzijing

export default function install(Vue) {
  // this code will cause the warning report above
  Vue.config.optionMergeStrategies.timers = Vue.config.optionMergeStrategies.methods
  Vue.mixin(VueTimers)
}

@Kelin2025 I do not know what's mean and how to resolve it.

masongzhi avatar Oct 30 '19 03:10 masongzhi

Any word on this. I am getting the same thing when using an array for the timers var instead of a standard object. Per the docs an array is acceptable.

Invalid value for option "timers": expected an Object, but got Array.

timers: [ { name: 'log', time: 10000, autostart: true, repeat: true, immediate: true}, { name: 'sample', time: 5000, autostart: false, repeat: true, immediate: true} ],

Can you provide instructions on how to fix it.

stevegroner avatar Jun 10 '20 06:06 stevegroner