import { storiesOf } from '@storybook/vue'
import { defineComponent, ref } from '@vue/composition-api'
import { useLoadingFun, useDebounceFun } from '../index'
import md from '../docs/loadingFun.md'
const Count = defineComponent({
template: `
EXAMPLE
count: {{count}}
loading: {{loading}}
`,
setup() {
const count = ref(0)
const run = async function () {
await new Promise(r => setTimeout(r, 1000)).then(data => {
count.value += 1
})
}
const { fun, loading } = useLoadingFun(run, 1000)
return {
count,
fun,
loading
}
}
})
storiesOf('Function decorator|useLoadingFun', module)
.add('loadingFun', () => Count, {
readme: {
sidebar: md
}
})