Skip to content

Commit

Permalink
feat: useProgress
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo-shen committed Jan 14, 2024
1 parent 5c71e8f commit 3862004
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/core/useProgress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# useProgress
1 change: 1 addition & 0 deletions packages/core/useProgress/README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# useProgress
8 changes: 8 additions & 0 deletions packages/core/useProgress/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { describe, expect, test } from 'vitest'
import { useProgress } from '.'

describe('useEllipsis', () => {
test('should be defined', () => {
expect(useProgress).toBeDefined()
})
})
1 change: 1 addition & 0 deletions packages/core/useProgress/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const useProgress = () => {}
6 changes: 4 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script setup lang="ts">
// import UseEllipsis from './demo/UseEllipsis.vue'
import UseLoading from './demo/UseLoading.vue'
// import UseLoading from './demo/UseLoading.vue'
import UseProgress from './demo/UseProgress.vue'
</script>

<template>
<!-- <UseEllipsis /> -->
<UseLoading />
<!-- <UseLoading /> -->
<UseProgress />
</template>
30 changes: 30 additions & 0 deletions src/demo/UseProgress.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useLoading } from '@noi/core'
const { isLoading, start, stop } = useLoading()
// const upload = () => {
// start();
// setTimeout(() => {
// stop()
// }, 1000)
// }
// const loading = ref(false)
// const upload = () => {
// loading.value = true
// setTimeout(() => {
// loading.value = false
// }, 1000)
// }
</script>

<template>
<div v-show="isLoading">loading...</div>
<button @click="start">start loading</button>
<button @click="stop">stop loading</button>
</template>

0 comments on commit 3862004

Please sign in to comment.