Kelin2025 / vue-timers

Mixin to manage your intervals in Vue.js
MIT License
231 stars 17 forks source link

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

Open Zhangzijing opened 5 years ago

Zhangzijing commented 5 years ago

mycode:

<template>
</template>

<script>

import { timer } from 'vue-timers'

export default {
  timers: [
    timer('log', 1000)
  ],
  methods: {
    log () {
      console.log('It works!')
    }
  }
}
</script>
Zhangzijing commented 5 years ago

main.js:


import VueTimers from 'vue-timers' 
Vue.use(VueTimers)
masongzhi commented 5 years ago
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.

stevegroner commented 4 years ago

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.