Skip to content

Commit e40d526

Browse files
committed
docs: update usage
1 parent 4101c07 commit e40d526

40 files changed

+94
-5224
lines changed

README.zh_CN.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
[Changelog](./CHANGELOG.md) · [English](./README.md) · 中文
2626
</div>
2727

28-
> [!IMPORTANT]
29-
> 这个库已经迁移到新的npm组织 [@vue-styled-components/core](https://npmjs.org/package/@vue-styled-components/core)
30-
> 旧的npm组织 已经废弃,不再发布新版本
31-
3228
## ✨特性
3329

3430
✅ 样式化 Vue 组件或原生组件

eslint.config.mjs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,4 @@ export default antfu(
1010
'**/coverage/**',
1111
],
1212
},
13-
{
14-
files: ['packages/plugins/typescript-syntax/**/*.ts'],
15-
rules: {
16-
'no-unused-vars': 'off',
17-
'no-cond-assign': 'warn',
18-
'no-console': 'warn',
19-
'unused-imports/no-unused-vars': 'warn',
20-
'regexp/no-unused-capturing-group': 'warn',
21-
'style/max-statements-per-line': 'warn',
22-
'regexp/no-super-linear-backtracking': 'warn',
23-
'unicorn/prefer-number-properties': 'warn',
24-
'style/no-mixed-operators': 'warn',
25-
'no-case-declarations': 'warn',
26-
},
27-
},
2813
)

packages/docs/guide/basic/passing-props.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ fallthrough attributes.(see [Props Declaration](https://vuejs.org/guide/componen
4949

5050
:::
5151

52+
**So we provide a vite plugin to support the generic type props same as `styled-components`. You can install the plugin [`@vue-styled-components/plugin`](https://github.com/vue-styled-components/plugin) to allow the following usage:**
53+
54+
```ts
55+
const StyledDiv = styled.div<color: string>`
56+
color: ${props => props.color}
57+
`
58+
```
59+
5260
## Use `attributes`
5361

5462
:::demo

packages/docs/guide/basic/quick-start.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ outline: deep
66

77
## Installation
88

9+
### Core
10+
911
Npm
1012

1113
```shell
@@ -24,6 +26,42 @@ Pnpm
2426
pnpm i @vue-styled-components/core
2527
```
2628

29+
### Vite Plugin
30+
31+
Npm
32+
33+
```shell
34+
npm i @vue-styled-components/plugin
35+
```
36+
37+
Yarn
38+
39+
```shell
40+
yarn add @vue-styled-components/plugin
41+
```
42+
43+
Pnpm
44+
45+
```shell
46+
pnpm i @vue-styled-components/plugin
47+
```
48+
49+
Vite Config
50+
51+
```ts
52+
import vueStyledPlugin from "@vue-styled-components/plugin"
53+
// ...
54+
55+
export default defineConfig({
56+
// ...
57+
plugins: [
58+
vueStyledPlugin()
59+
// ...
60+
]
61+
})
62+
```
63+
64+
2765
## Getting Started
2866

2967
:::demo

packages/docs/zh/guide/basic/passing-props.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ const blur = () => (borderColor.value = 'darkred')
4545

4646
:::
4747

48+
**所以我们提供了一个插件使得定义 props 与 `styled-components` 一样. 你可以安装插件 [`@vue-styled-components/plugin`](https://github.com/vue-styled-components/plugin) 以支持一下写法:**
49+
50+
```ts
51+
const StyledDiv = styled.div<color: string>`
52+
color: ${props => props.color}
53+
`
54+
4855
## 使用 `attributes`
4956

5057
:::demo

packages/docs/zh/guide/basic/quick-start.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ outline: deep
66

77
## 安装
88

9+
### 核心库
10+
911
Npm
1012

1113
```shell
@@ -24,6 +26,43 @@ Pnpm
2426
pnpm i @vue-styled-components/core
2527
```
2628

29+
### Vite 插件
30+
31+
32+
33+
Npm
34+
35+
```shell
36+
npm i @vue-styled-components/plugin
37+
```
38+
39+
Yarn
40+
41+
```shell
42+
yarn add @vue-styled-components/plugin
43+
```
44+
45+
Pnpm
46+
47+
```shell
48+
pnpm i @vue-styled-components/plugin
49+
```
50+
51+
Vite 配置
52+
53+
```ts
54+
import vueStyledPlugin from "@vue-styled-components/plugin"
55+
// ...
56+
57+
export default defineConfig({
58+
// ...
59+
plugins: [
60+
vueStyledPlugin()
61+
// ...
62+
]
63+
})
64+
```
65+
2766
## 开始使用
2867

2968
:::demo
@@ -32,7 +71,7 @@ pnpm i @vue-styled-components/core
3271
<script setup lang="ts">
3372
import { styled } from '@vue-styled-components/core'
3473
35-
const StyledDiv = styled.div`
74+
const StyledDiv = styled.div<{ color?: string }>`
3675
display: flex;
3776
justify-content: center;
3877
align-items: center;
@@ -41,7 +80,7 @@ pnpm i @vue-styled-components/core
4180
background-color: #4c5a6d;
4281
font-size: 20px;
4382
font-weight: bold;
44-
color: #fff;
83+
color: ${props => props.color || '#fff'};
4584
`
4685
</script>
4786

packages/playground/vite.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import vue from '@vitejs/plugin-vue'
22
import vueJsx from '@vitejs/plugin-vue-jsx'
33
import { defineConfig } from 'vite'
4-
import p from '../plugins/typescript-syntax/index'
54

65
// https://vitejs.dev/config/
76
export default defineConfig({
@@ -10,7 +9,6 @@ export default defineConfig({
109
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.less'],
1110
},
1211
plugins: [
13-
p() as any,
1412
vue({
1513
script: {
1614
defineModel: true,

packages/plugins/typescript-syntax/README.md

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)