未验证 提交 3bdb469b 编辑于 作者: cyole's avatar cyole
浏览文件

chore: initialize zui demo project

上级
# 提示 Tip
TODO: 补充组件用途、提示类型、标题和默认插槽用法。
## 演示
<!-- DEMO -->
<demo vue="tip/demos/basic.vue" />
<!-- DEMO -->
## API
<!-- API -->
TODO: 对照 `src/tip/src/interface.ts` 补充 Props 和 Slots 表格。
<!-- API -->
export * from './src/interface'
export { default as ZTip } from './src/Tip.vue'
<script setup lang="ts">
import type { TipSlots } from './interface'
import { computed } from 'vue'
import { tipProps } from './interface'
import { styles } from './styles'
defineOptions({ name: 'ZTip' })
const props = defineProps(tipProps)
defineSlots<TipSlots>()
const typeClass = computed(() => {
return {
info: styles.classes.info,
success: styles.classes.success,
warning: styles.classes.warning,
error: styles.classes.error,
}[props.type]
})
</script>
<template>
<section :class="[styles.classes.root, typeClass]">
<div
v-if="title || $slots.title"
:class="styles.classes.title"
>
<slot name="title">
{{ title }}
</slot>
</div>
<div :class="styles.classes.content">
<slot>
{{ content }}
</slot>
</div>
</section>
</template>
import type { ExtractPublicPropTypes, PropType, VNodeChild } from 'vue'
export type TipType = 'info' | 'success' | 'warning' | 'error'
export const tipProps = {
type: {
type: String as PropType<TipType>,
default: 'info',
},
title: String,
content: String,
} as const
export type TipProps = ExtractPublicPropTypes<typeof tipProps>
export interface TipSlots {
title?: () => VNodeChild
default?: () => VNodeChild
}
import { createStyleSheet } from '../../../_utils/jss'
export const styles = createStyleSheet({
root: {
padding: 12,
borderRadius: 6,
border: '1px solid transparent',
},
title: {
marginBottom: 4,
fontWeight: 600,
},
content: {
fontSize: 14,
lineHeight: '22px',
},
info: {
borderColor: '#91caff',
background: '#e6f4ff',
color: '#0958d9',
},
success: {
borderColor: '#b7eb8f',
background: '#f6ffed',
color: '#237804',
},
warning: {
borderColor: '#ffe58f',
background: '#fffbe6',
color: '#ad6800',
},
error: {
borderColor: '#ffa39e',
background: '#fff1f0',
color: '#a8071a',
},
})
# 组件校对记录
- 组件目录:
- 组件名称:
- 整理人:
- 日期:
## 文档检查
| 检查项 | 结果 | 备注 |
| ---------------------------- | ------ | ---- |
| 组件用途说明清晰 | 待检查 | |
| demo 覆盖基础用法 | 待检查 | |
| API 表格与 interface.ts 一致 | 待检查 | |
| 插槽和事件无遗漏 | 待检查 | |
| 注意事项或边界场景已说明 | 待检查 | |
## 建议补充
-
# 周报
- 周期:
- 姓名:
- 本周组件:
## 完成内容
| 组件 | 文档 | Demo | API | 测试场景 | 备注 |
| ---- | ------ | ------ | ------ | -------- | ---- |
| | 未开始 | 未开始 | 未开始 | 未开始 | |
## 验证命令
-
## 问题和建议
-
## 下周计划
-
it('works', () => {
expect(true).toBe(true)
})
{
"compilerOptions": {
"target": "esnext",
"jsx": "preserve",
"jsxImportSource": "vue",
"lib": [
"es2023",
"DOM"
],
"moduleDetection": "force",
"module": "preserve",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"types": [
"node",
"vitest/globals"
],
"strict": true,
"noUnusedLocals": true,
"esModuleInterop": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true
},
"include": [
"src",
"tests"
]
}
import { defineConfig } from 'tsdown'
import VueJsx from 'unplugin-vue-jsx/rolldown'
import Vue from 'unplugin-vue/rolldown'
export default defineConfig({
entry: ['./src/index.ts'],
outDir: 'es',
plugins: [
Vue({ isProduction: true }),
VueJsx(),
],
unbundle: true,
exports: true,
platform: 'browser',
dts: {
vue: true,
},
})
import {
defineConfig,
presetAttributify,
presetIcons,
presetWind4,
} from 'unocss'
export default defineConfig({
shortcuts: [],
presets: [
presetWind4(),
presetAttributify({
ignoreAttributes: [':size'],
}),
presetIcons({
scale: 1.2,
warn: true,
}),
],
})
{
"outputDirectory": "dist"
}
import VueJsx from 'unplugin-vue-jsx/vite'
import Vue from 'unplugin-vue/vite'
import { defineConfig } from 'vitest/config'
export default defineConfig({
plugins: [
Vue(),
VueJsx(),
],
test: {
environment: 'happy-dom',
globals: true,
coverage: {
provider: 'v8',
include: ['src/**/*.{ts,tsx,vue}'],
exclude: ['**/demos/**'],
},
},
})
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册