preset-attributify 不要用b

This commit is contained in:
2024-08-22 22:35:54 +08:00
parent 38e95fc615
commit 708819f1a7
2 changed files with 11 additions and 8 deletions

View File

@ -19,7 +19,7 @@ import type { FunctionalComponent } from 'vue';
// https://cn.vuejs.org/guide/extras/render-function#typing-functional-components
const FComponent: FunctionalComponent<{ prop: string }> = (props, context) => (
<>
<div b="1 solid pink" text="pink">
<div border="1 solid pink" text="pink">
<span>This is a functional component with prop: {JSON.stringify(props)}</span>
</div>
</>
@ -33,7 +33,6 @@ const FComponent: FunctionalComponent<{ prop: string }> = (props, context) => (
<li><router-link :to="{ name: 'TsEnumUtil' }">TS Enum Util</router-link></li>
<li><router-link :to="{ name: 'SomePage' }">Some Page</router-link></li>
<li><router-link :to="{ name: '中文页面' }">中文-页面.page.vue</router-link></li>
<li><router-link :to="{ name: 'MdPage' }">Markdown Page</router-link></li>
</ul>
<FComponent prop="Hello World" />
<div text-orange></div>

View File

@ -1,15 +1,19 @@
// https://unocss.dev/presets/attributify#vue-3
import type { BasicAttributes, PseudoPrefix } from '@unocss/preset-attributify';
// https://github.com/unocss/unocss/pull/4095
type BasicAttributesFix = BasicAttributes | 'b';
// type BasicAttributesFix = import('@unocss/preset-attributify').BasicAttributes | 'b';
type AttributifyNames<Prefix extends string = ''> =
| `${Prefix}${BasicAttributesFix}`
| `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
// type AttributifyNames<Prefix extends string = ''> =
// | `${Prefix}${BasicAttributesFix}`
// | `${Prefix}${PseudoPrefix}:${BasicAttributes}`;
// declare module '@vue/runtime-dom' {
// interface HTMLAttributes extends Partial<Record<AttributifyNames, string | boolean>> {}
// }
declare module '@vue/runtime-dom' {
interface HTMLAttributes extends Partial<Record<AttributifyNames, string | boolean>> {}
interface HTMLAttributes
extends Partial<Record<import('@unocss/preset-attributify').AttributifyNames, string | boolean>> {}
}
export {};