config
Some checks failed
Test / build (lts/*, ubuntu-latest) (push) Has been cancelled
Test / build (lts/*, windows-latest) (push) Has been cancelled

This commit is contained in:
zzs01@yunemao.com 2024-09-12 16:45:22 +08:00
parent 31f7c998a2
commit cbb14e0916
10 changed files with 7 additions and 103 deletions

View File

@ -1,9 +0,0 @@
## Components
Components in this dir will be auto-registered and on-demand, powered by [`unplugin-vue-components`](https://github.com/antfu/unplugin-vue-components).
### Icons
You can use icons from almost any icon sets by the power of [Iconify](https://iconify.design/).
It will only bundle the icons you use. Check out [`unplugin-icons`](https://github.com/antfu/unplugin-icons) for more details.

View File

@ -1,20 +0,0 @@
## File-based Routing
Routes will be auto-generated for Vue files in this dir with the same file structure.
Check out [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) for more details.
### Path Aliasing
`~/` is aliased to `./src/` folder.
For example, instead of having
```ts
import { isDark } from '../../../../composables'
```
now, you can use
```ts
import { isDark } from '~/composables'
```

View File

@ -1,5 +0,0 @@
<template>
<div>
Not Found
</div>
</template>

View File

@ -1,22 +0,0 @@
<script setup lang="ts">
const params = useRoute('/hi/[name]').params
const router = useRouter()
</script>
<template>
<div>
<div i-carbon-pedestrian inline-block text-4xl />
<p>
Hi, {{ params.name }}
</p>
<p text-sm op50>
<em>Dynamic route!</em>
</p>
<div>
<button m-3 mt-8 text-sm btn @click="router.back()">
Back
</button>
</div>
</div>
</template>

View File

@ -1,3 +0,0 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`component of TheCounter.vue > should render 1`] = `"<div>10 <button class="inc"> + </button><button class="dec"> - </button></div>"`;

View File

@ -1,7 +0,0 @@
import { describe, expect, it } from 'vitest'
describe('hi', () => {
it('should works', () => {
expect(1 + 1).toEqual(2)
})
})

View File

@ -1,22 +0,0 @@
import { mount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'
import TheCounter from '../src/components/TheCounter.vue'
describe('component of TheCounter.vue', () => {
it('should render', () => {
const wrapper = mount(TheCounter, { props: { initial: 10 } })
expect(wrapper.text()).toContain('10')
expect(wrapper.html()).toMatchSnapshot()
})
it('should be interactive', async () => {
const wrapper = mount(TheCounter, { props: { initial: 0 } })
expect(wrapper.text()).toContain('0')
expect(wrapper.find('.inc').exists()).toBe(true)
await wrapper.get('button').trigger('click')
expect(wrapper.text()).toContain('1')
})
})

2
typed-router.d.ts vendored
View File

@ -19,7 +19,5 @@ declare module 'vue-router/auto-routes' {
*/
export interface RouteNamedMap {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/[...all]': RouteRecordInfo<'/[...all]', '/:all(.*)', { all: ParamValue<true> }, { all: ParamValue<false> }>,
'/hi/[name]': RouteRecordInfo<'/hi/[name]', '/hi/:name', { name: ParamValue<true> }, { name: ParamValue<false> }>,
}
}

View File

@ -3,7 +3,6 @@ import {
presetAttributify,
presetIcons,
presetUno,
presetWebFonts,
} from 'unocss'
export default defineConfig({
@ -18,12 +17,12 @@ export default defineConfig({
scale: 1.2,
warn: true,
}),
presetWebFonts({
fonts: {
sans: 'DM Sans',
serif: 'DM Serif Display',
mono: 'DM Mono',
},
}),
// presetWebFonts({
// fonts: {
// sans: 'DM Sans',
// serif: 'DM Serif Display',
// mono: 'DM Mono',
// },
// }),
],
})

View File

@ -60,9 +60,4 @@ export default defineConfig({
// see uno.config.ts for config
UnoCSS(),
],
// https://github.com/vitest-dev/vitest
test: {
environment: 'jsdom',
},
})