@opentiny/vue-docs 3.28.1 → 3.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demos/apis/action-menu.js +22 -0
- package/demos/apis/alert.js +19 -22
- package/demos/apis/button-group.js +15 -0
- package/demos/apis/calendar-view.js +5 -5
- package/demos/apis/cascader-view.js +5 -5
- package/demos/apis/dialog-box.js +39 -38
- package/demos/apis/drawer.js +31 -0
- package/demos/apis/dropdown.js +39 -1
- package/demos/apis/filter-panel.js +21 -1
- package/demos/apis/fluent-editor.js +30 -0
- package/demos/apis/form.js +11 -0
- package/demos/apis/fullscreen.js +10 -11
- package/demos/apis/grid.js +131 -16
- package/demos/apis/guide.js +14 -0
- package/demos/apis/link.js +11 -0
- package/demos/apis/message.js +48 -22
- package/demos/apis/modal.js +34 -31
- package/demos/apis/notify.js +13 -13
- package/demos/apis/rate.js +15 -0
- package/demos/apis/search-box.js +343 -0
- package/demos/apis/select.js +14 -2
- package/demos/apis/tag-input.js +182 -0
- package/demos/apis/tree.js +23 -23
- package/demos/mobile-first/app/button-group/display-mode.vue +31 -0
- package/demos/mobile-first/app/button-group/webdoc/button-group.js +13 -0
- package/demos/mobile-first/app/calendar-view/webdoc/calendar-view.js +5 -4
- package/demos/mobile-first/app/modal/webdoc/modal.js +2 -1
- package/demos/pc/app/alert/center.spec.ts +8 -0
- package/demos/pc/app/alert/custom-close.spec.ts +39 -9
- package/demos/pc/app/alert/icon.spec.ts +18 -7
- package/demos/pc/app/alert/show-icon.spec.ts +1 -1
- package/demos/pc/app/anchor/webdoc/anchor.js +1 -0
- package/demos/pc/app/base-select/copy-multi.spec.ts +1 -1
- package/demos/pc/app/button-group/display-mode-composition-api.vue +23 -0
- package/demos/pc/app/button-group/display-mode.spec.ts +0 -0
- package/demos/pc/app/button-group/display-mode.vue +31 -0
- package/demos/pc/app/button-group/sup-composition-api.vue +1 -0
- package/demos/pc/app/button-group/sup.vue +1 -0
- package/demos/pc/app/button-group/webdoc/button-group.js +14 -0
- package/demos/pc/app/calendar-view/calendar-event.spec.ts +1 -1
- package/demos/pc/app/calendar-view/custom-day-bg-color.vue +10 -0
- package/demos/pc/app/calendar-view/webdoc/calendar-view.js +4 -4
- package/demos/pc/app/cascader/filter-mode-composition-api.vue +2 -3
- package/demos/pc/app/checkbox/checked-composition-api.vue +3 -3
- package/demos/pc/app/checkbox/checked.vue +3 -3
- package/demos/pc/app/date-picker/align.spec.ts +10 -13
- package/demos/pc/app/date-picker/clear.spec.ts +3 -3
- package/demos/pc/app/date-picker/default-value.spec.ts +4 -4
- package/demos/pc/app/date-picker/events.spec.ts +2 -2
- package/demos/pc/app/date-picker/format.spec.ts +3 -3
- package/demos/pc/app/date-picker/now.spec.ts +4 -4
- package/demos/pc/app/date-picker/shortcuts.spec.ts +1 -1
- package/demos/pc/app/date-picker/slot.spec.ts +5 -5
- package/demos/pc/app/dialog-box/basic-usage.spec.ts +5 -5
- package/demos/pc/app/dialog-box/form-in-dialog.spec.ts +1 -2
- package/demos/pc/app/drawer/basic-usage.spec.ts +4 -3
- package/demos/pc/app/drawer/close-on-press-escape.spec.ts +4 -2
- package/demos/pc/app/drawer/placement.spec.ts +4 -4
- package/demos/pc/app/drawer/show-header.spec.ts +3 -2
- package/demos/pc/app/drawer/webdoc/drawer.js +3 -2
- package/demos/pc/app/dropdown/show-icon-composition-api.vue +1 -1
- package/demos/pc/app/dropdown/show-icon.vue +1 -1
- package/demos/pc/app/dropdown/tip-composition-api.vue +5 -2
- package/demos/pc/app/dropdown/tip.vue +5 -2
- package/demos/pc/app/dropdown/webdoc/dropdown.js +2 -2
- package/demos/pc/app/filter-panel/size-composition-api.vue +58 -0
- package/demos/pc/app/filter-panel/size.spec.ts +23 -0
- package/demos/pc/app/filter-panel/size.vue +68 -0
- package/demos/pc/app/filter-panel/webdoc/filter-panel.js +13 -0
- package/demos/pc/app/flowchart/basic-usage-composition-api.vue +10 -260
- package/demos/pc/app/flowchart/basic-usage.spec.ts +2 -1
- package/demos/pc/app/flowchart/basic-usage.vue +4 -249
- package/demos/pc/app/flowchart/slots-composition-api.vue +182 -0
- package/demos/pc/app/flowchart/slots.spec.ts +24 -0
- package/demos/pc/app/flowchart/slots.vue +193 -0
- package/demos/pc/app/flowchart/webdoc/flowchart.js +14 -2
- package/demos/pc/app/form/basic-usage.spec.ts +6 -4
- package/demos/pc/app/form/custom-validation-string-length-composition-api.vue +38 -0
- package/demos/pc/app/form/custom-validation-string-length.spec.ts +18 -0
- package/demos/pc/app/form/custom-validation-string-length.vue +28 -13
- package/demos/pc/app/form/group-form-composition-api.vue +2 -2
- package/demos/pc/app/form/group-form.vue +2 -2
- package/demos/pc/app/grid/filter/advanced-filter-composition-api.vue +1 -1
- package/demos/pc/app/grid/filter/advanced-filter.spec.js +1 -0
- package/demos/pc/app/grid/filter/advanced-filter.vue +1 -1
- package/demos/pc/app/grid/filter/custom-filter-composition-api.vue +46 -23
- package/demos/pc/app/grid/filter/custom-filter.spec.js +1 -1
- package/demos/pc/app/grid/filter/custom-filter.vue +47 -24
- package/demos/pc/app/grid/filter/default-filter-composition-api.vue +5 -1
- package/demos/pc/app/grid/filter/default-filter.spec.ts +1 -0
- package/demos/pc/app/grid/filter/default-filter.vue +4 -1
- package/demos/pc/app/grid/filter/filter-label-value-composition-api.vue +71 -0
- package/demos/pc/app/grid/filter/filter-label-value.spec.ts +27 -0
- package/demos/pc/app/grid/filter/filter-label-value.vue +78 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component-composition-api.vue +116 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component.spec.ts +20 -0
- package/demos/pc/app/grid/filter/input-filter-custom-component.vue +126 -0
- package/demos/pc/app/grid/filter/layout-order-filter-composition-api.vue +114 -0
- package/demos/pc/app/grid/filter/layout-order-filter.spec.ts +31 -0
- package/demos/pc/app/grid/filter/layout-order-filter.vue +123 -0
- package/demos/pc/app/grid/toolbar/custom-toolbar.spec.js +1 -1
- package/demos/pc/app/grid/webdoc/grid-filter.js +89 -40
- package/demos/pc/app/guide/show-close-composition-api.vue +77 -0
- package/demos/pc/app/guide/show-close.spec.ts +37 -0
- package/demos/pc/app/guide/show-close.vue +84 -0
- package/demos/pc/app/guide/webdoc/guide.js +12 -0
- package/demos/pc/app/icon/advance-icons.js +108 -2
- package/demos/pc/app/icon/advance-usage-composition-api.vue +26 -1
- package/demos/pc/app/icon/advance-usage.vue +27 -1
- package/demos/pc/app/icon/webdoc/icon.js +5 -3
- package/demos/pc/app/input/resize.spec.ts +2 -2
- package/demos/pc/app/link/custom-icon-composition-api.vue +1 -1
- package/demos/pc/app/link/custom-icon.vue +1 -1
- package/demos/pc/app/link/target-composition-api.vue +24 -0
- package/demos/pc/app/link/target.spec.ts +41 -0
- package/demos/pc/app/link/target.vue +30 -0
- package/demos/pc/app/link/webdoc/link.js +14 -0
- package/demos/pc/app/message/basic-usage-composition-api.vue +48 -0
- package/demos/pc/app/message/basic-usage.spec.ts +27 -0
- package/demos/pc/app/message/basic-usage.vue +50 -0
- package/demos/pc/app/message/message-close-composition-api.vue +25 -0
- package/demos/pc/app/message/message-close.spec.ts +9 -0
- package/demos/pc/app/message/message-close.vue +32 -0
- package/demos/pc/app/message/message-duration-composition-api.vue +25 -0
- package/demos/pc/app/message/message-duration.spec.ts +9 -0
- package/demos/pc/app/message/message-duration.vue +32 -0
- package/demos/pc/app/message/prevent-duplicate-composition-api.vue +25 -0
- package/demos/pc/app/message/prevent-duplicate.spec.ts +9 -0
- package/demos/pc/app/message/prevent-duplicate.vue +32 -0
- package/demos/pc/app/message/webdoc/message.cn.md +7 -0
- package/demos/pc/app/message/webdoc/message.en.md +7 -0
- package/demos/pc/app/message/webdoc/message.js +56 -0
- package/demos/pc/app/modal/basic-usage.spec.ts +3 -3
- package/demos/pc/app/modal/modal-footer-composition-api.vue +3 -3
- package/demos/pc/app/modal/modal-footer.spec.ts +9 -4
- package/demos/pc/app/modal/modal-footer.vue +3 -3
- package/demos/pc/app/modal/modal-header.spec.ts +2 -2
- package/demos/pc/app/modal/modal-size.spec.ts +2 -2
- package/demos/pc/app/modal/status.spec.ts +22 -15
- package/demos/pc/app/nav-menu/overflow.spec.ts +1 -1
- package/demos/pc/app/popconfirm/custom-class.spec.ts +0 -1
- package/demos/pc/app/popconfirm/slot-message.spec.ts +10 -2
- package/demos/pc/app/popconfirm/trigger.spec.ts +16 -12
- package/demos/pc/app/popover/basic-usage.spec.js +3 -8
- package/demos/pc/app/popover/custom-popper.spec.js +2 -2
- package/demos/pc/app/popover/delay.spec.js +2 -2
- package/demos/pc/app/popover/disabled.spec.js +2 -2
- package/demos/pc/app/popover/events.spec.js +1 -1
- package/demos/pc/app/popover/ignore-boundaries.spec.js +2 -3
- package/demos/pc/app/popover/offset.spec.js +17 -31
- package/demos/pc/app/radio/dynamic-disable-composition-api.vue +3 -3
- package/demos/pc/app/radio/dynamic-disable.vue +2 -2
- package/demos/pc/app/rate/clearable-composition-api.vue +20 -0
- package/demos/pc/app/rate/clearable.spec.js +74 -0
- package/demos/pc/app/rate/clearable.vue +28 -0
- package/demos/pc/app/rate/webdoc/rate.js +12 -0
- package/demos/pc/app/search/events.spec.ts +1 -1
- package/demos/pc/app/search-box/append-to-body-composition-api.vue +300 -0
- package/demos/pc/app/search-box/append-to-body.vue +308 -0
- package/demos/pc/app/search-box/auto-match-composition-api.vue +162 -0
- package/demos/pc/app/search-box/auto-match.vue +170 -0
- package/demos/pc/app/search-box/basic-usage-composition-api.vue +269 -0
- package/demos/pc/app/search-box/basic-usage.vue +277 -0
- package/demos/pc/app/search-box/custom-panel-composition-api.vue +63 -0
- package/demos/pc/app/search-box/custom-panel.vue +72 -0
- package/demos/pc/app/search-box/default-field-composition-api.vue +163 -0
- package/demos/pc/app/search-box/default-field.vue +171 -0
- package/demos/pc/app/search-box/editable-composition-api.vue +311 -0
- package/demos/pc/app/search-box/editable.vue +320 -0
- package/demos/pc/app/search-box/empty-placeholder-composition-api.vue +162 -0
- package/demos/pc/app/search-box/empty-placeholder.vue +170 -0
- package/demos/pc/app/search-box/events-composition-api.vue +169 -0
- package/demos/pc/app/search-box/events.vue +173 -0
- package/demos/pc/app/search-box/group-key-composition-api.vue +257 -0
- package/demos/pc/app/search-box/group-key.vue +266 -0
- package/demos/pc/app/search-box/help-composition-api.vue +166 -0
- package/demos/pc/app/search-box/help.vue +175 -0
- package/demos/pc/app/search-box/id-map-key-composition-api.vue +131 -0
- package/demos/pc/app/search-box/id-map-key.vue +140 -0
- package/demos/pc/app/search-box/item-placeholder-composition-api.vue +119 -0
- package/demos/pc/app/search-box/item-placeholder.vue +127 -0
- package/demos/pc/app/search-box/max-length-composition-api.vue +29 -0
- package/demos/pc/app/search-box/max-length.vue +38 -0
- package/demos/pc/app/search-box/max-time-length-composition-api.vue +53 -0
- package/demos/pc/app/search-box/max-time-length.vue +62 -0
- package/demos/pc/app/search-box/merge-tag-composition-api.vue +59 -0
- package/demos/pc/app/search-box/merge-tag.vue +68 -0
- package/demos/pc/app/search-box/panel-max-height-composition-api.vue +162 -0
- package/demos/pc/app/search-box/panel-max-height.vue +170 -0
- package/demos/pc/app/search-box/potential-match-composition-api.vue +193 -0
- package/demos/pc/app/search-box/potential-match.vue +201 -0
- package/demos/pc/app/search-box/settings-composition-api.vue +163 -0
- package/demos/pc/app/search-box/settings.vue +171 -0
- package/demos/pc/app/search-box/size-composition-api.vue +162 -0
- package/demos/pc/app/search-box/size.vue +170 -0
- package/demos/pc/app/search-box/split-input-value-composition-api.vue +162 -0
- package/demos/pc/app/search-box/split-input-value.vue +170 -0
- package/demos/pc/app/search-box/suffix-icon-composition-api.vue +209 -0
- package/demos/pc/app/search-box/suffix-icon.vue +219 -0
- package/demos/pc/app/search-box/v-model-composition-api.vue +174 -0
- package/demos/pc/app/search-box/v-model.vue +182 -0
- package/demos/pc/app/search-box/webdoc/search-box.cn.md +7 -0
- package/demos/pc/app/search-box/webdoc/search-box.en.md +7 -0
- package/demos/pc/app/search-box/webdoc/search-box.js +257 -0
- package/demos/pc/app/select/copy-multi.spec.ts +1 -1
- package/demos/pc/app/select-wrapper/copy-multi.spec.ts +2 -1
- package/demos/pc/app/tabs/basic-usage.spec.ts +2 -2
- package/demos/pc/app/tabs/more-show-all.spec.ts +2 -1
- package/demos/pc/app/tabs/tabs-events-close-composition-api.vue +8 -2
- package/demos/pc/app/tabs/tabs-events-close.vue +8 -2
- package/demos/pc/app/tag/basic-usage.spec.ts +1 -1
- package/demos/pc/app/tag/color-border.spec.ts +2 -2
- package/demos/pc/app/tag/max-width.spec.ts +1 -1
- package/demos/pc/app/tag/size.spec.ts +3 -3
- package/demos/pc/app/tag/slot-default.spec.ts +3 -3
- package/demos/pc/app/tag-group/basic-usage.spec.js +5 -5
- package/demos/pc/app/tag-group/tag-group-effect.spec.js +10 -10
- package/demos/pc/app/tag-group/tag-group-event.spec.js +1 -1
- package/demos/pc/app/tag-input/basic-usage-composition-api.vue +29 -0
- package/demos/pc/app/tag-input/basic-usage.spec.ts +0 -0
- package/demos/pc/app/tag-input/basic-usage.vue +38 -0
- package/demos/pc/app/tag-input/clearable-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/clearable-tag.vue +27 -0
- package/demos/pc/app/tag-input/collapsed-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/collapsed-tag.vue +28 -0
- package/demos/pc/app/tag-input/disabled-readonly-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/disabled-readonly.vue +29 -0
- package/demos/pc/app/tag-input/draggable-tag-composition-api.vue +12 -0
- package/demos/pc/app/tag-input/draggable-tag.spec.ts +0 -0
- package/demos/pc/app/tag-input/draggable-tag.vue +20 -0
- package/demos/pc/app/tag-input/max-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/max.vue +28 -0
- package/demos/pc/app/tag-input/prefix-suffix-composition-api.vue +26 -0
- package/demos/pc/app/tag-input/prefix-suffix.vue +34 -0
- package/demos/pc/app/tag-input/separator-tag-composition-api.vue +20 -0
- package/demos/pc/app/tag-input/separator-tag.vue +28 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.cn.md +7 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.en.md +7 -0
- package/demos/pc/app/tag-input/webdoc/tag-input.js +107 -0
- package/demos/pc/app/time-picker/basic-usage.spec.ts +5 -4
- package/demos/pc/app/time-picker/clearable.spec.ts +5 -4
- package/demos/pc/app/time-picker/default-value.spec.ts +2 -2
- package/demos/pc/app/time-picker/disabled.spec.ts +4 -3
- package/demos/pc/app/time-picker/format.spec.ts +8 -11
- package/demos/pc/app/time-picker/is-range.spec.ts +4 -3
- package/demos/pc/app/time-picker/name.spec.ts +1 -1
- package/demos/pc/app/time-picker/placeholder.spec.ts +3 -3
- package/demos/pc/app/time-picker/popper-class.spec.ts +1 -1
- package/demos/pc/app/time-picker/size.spec.ts +2 -1
- package/demos/pc/app/time-select/basic-usage.spec.ts +1 -1
- package/demos/pc/app/time-select/clear-icon.spec.ts +1 -2
- package/demos/pc/app/time-select/focus.spec.ts +1 -1
- package/demos/pc/app/time-select/picker-options.spec.ts +2 -1
- package/demos/pc/app/time-select/range-placeholder.spec.ts +2 -2
- package/demos/pc/app/time-select/size-medium.spec.ts +3 -3
- package/demos/pc/app/tooltip/delay.spec.js +7 -9
- package/demos/pc/app/tooltip/offset.spec.js +0 -2
- package/demos/pc/app/tooltip/popper-options.spec.js +2 -1
- package/demos/pc/menus.js +6 -4
- package/demos/pc/webdoc/changelog-en.md +209 -86
- package/demos/pc/webdoc/changelog.md +176 -257
- package/demos/pc/webdoc/develop-demo-en.md +13 -13
- package/demos/pc/webdoc/import-components.md +1 -1
- package/demos/pc/webdoc/introduce.md +2 -0
- package/demos/pc/webdoc/skills-en.md +107 -0
- package/demos/pc/webdoc/skills.md +107 -0
- package/demos/pc/webdoc/theme-en.md +82 -79
- package/demos/pc/webdoc/v3.28.0-release-article.md +943 -0
- package/demos/saas/menus.js +1 -0
- package/package.json +21 -20
- package/playground/App.vue +6 -4
- package/playground/shims/vue-search-box.mjs +154 -0
- package/public/static/css/mobile-dark-theme.css +1 -0
- package/src/i18n/index.js +1 -2
- package/src/main.js +8 -5
- package/src/style.css +5 -0
- package/src/views/components-doc/common.vue +0 -25
- package/src/views/components-doc/mobile.vue +49 -2
- package/vite.config.ts +3 -2
- package/vite.extend.ts +65 -0
- package/demos/pc/app/grid/webdoc/grid-ai-agent.js +0 -23
- package/demos/pc/webdoc/mcp-en.md +0 -101
- package/demos/pc/webdoc/mcp.md +0 -101
- package/src/components/mcp-docs.vue +0 -33
- package/src/composable/useTinyRemoter.ts +0 -176
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
# Development Example
|
|
4
4
|
|
|
5
|
-
This article is based on[Vite](https://cn.vitejs.dev/) Project example to show how to use`TinyVue`components.
|
|
5
|
+
This article is based on [Vite](https://cn.vitejs.dev/) Project example to show how to use `TinyVue` components.
|
|
6
6
|
|
|
7
7
|
## Building the Vite project
|
|
8
8
|
|
|
9
|
-
Create a`Vite`
|
|
9
|
+
Create a `Vite` project:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
yarn create vite
|
|
@@ -14,7 +14,7 @@ yarn create vite
|
|
|
14
14
|
npm init vite@latest
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
After creating the `Vite` project, go to the project directory and run the following commands to download and start the project:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
yarn
|
|
@@ -26,13 +26,13 @@ yarn dev
|
|
|
26
26
|
npm run dev
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
After the browser is started, if the following interface is displayed, it indicates that`Vite`
|
|
29
|
+
After the browser is started, if the following interface is displayed, it indicates that the `Vite` project is started successfully.
|
|
30
30
|
|
|
31
31
|
<img src="@demos/resource/vite-vue.png" class="image" style="box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14)" ><br><br>
|
|
32
32
|
|
|
33
|
-
## Install and use`TinyVue`Components
|
|
33
|
+
## Install and use `TinyVue` Components
|
|
34
34
|
|
|
35
|
-
Run the following command to install the`Vue 3.0`version of`TinyVue`
|
|
35
|
+
Run the following command to install the `Vue 3.0` version of `TinyVue` component library:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
yarn add @opentiny/vue@3
|
|
@@ -40,7 +40,7 @@ yarn add @opentiny/vue@3
|
|
|
40
40
|
npm install @opentiny/vue@3
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Then modify the`vite.config.js`, add the following code
|
|
43
|
+
Then modify the `vite.config.js`, and add the following code:
|
|
44
44
|
|
|
45
45
|
```js {8-10}
|
|
46
46
|
//vite.config.js
|
|
@@ -56,9 +56,9 @@ export default defineConfig({
|
|
|
56
56
|
})
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
When the installation is complete, press`Ctrl + C`
|
|
59
|
+
When the installation is complete, press `Ctrl + C` to interrupt the current service, and then run `yarn dev` or `npm run dev` to restart the service.
|
|
60
60
|
|
|
61
|
-
Next, modify the`App.vue`file, add the
|
|
61
|
+
Next, modify the `App.vue` file, and add the following code (using the `Button` component as an example):
|
|
62
62
|
|
|
63
63
|
```js {5,11}
|
|
64
64
|
<script setup>
|
|
@@ -86,9 +86,9 @@ import { Button as TinyButton } from '@opentiny/vue'
|
|
|
86
86
|
</style>
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
In the above code, `<script setup>` is a compiler syntax sugar used in single file components `SFC` with Composition `API`. For details, see [Vue official website](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup).
|
|
90
90
|
|
|
91
|
-
If you are not familiar with the above syntax, you can also use the standard`SFC`
|
|
91
|
+
If you are not familiar with the above syntax, you can also use the standard `SFC` format:
|
|
92
92
|
|
|
93
93
|
```js
|
|
94
94
|
<template>
|
|
@@ -106,7 +106,7 @@ export default {
|
|
|
106
106
|
</script>
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
Alternatively,
|
|
109
|
+
Alternatively, you can use single component import for `TinyVue` components:
|
|
110
110
|
|
|
111
111
|
```js
|
|
112
112
|
<template>
|
|
@@ -124,6 +124,6 @@ export default {
|
|
|
124
124
|
</script>
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
The green button shown below should appear on the browser interface, indicating that`TinyVue`
|
|
127
|
+
The green button shown below should appear on the browser interface, indicating that the `TinyVue` component has been introduced and takes effect.
|
|
128
128
|
|
|
129
129
|
<img src="@demos/resource/tiny-vue.png" class="image" style="box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14)" ><br><br>
|
|
@@ -118,7 +118,7 @@ public-hoist-pattern[]=@opentiny/*
|
|
|
118
118
|
|
|
119
119
|
## `vite` 工程多组件引入按需加载和打包配置方法
|
|
120
120
|
|
|
121
|
-
通过配置 `@opentiny/vue-vite-import`
|
|
121
|
+
通过配置 `@opentiny/vue-vite-import` 插件可以按需打包 pc 或者移动的组件,减少组件库打包后的体积。
|
|
122
122
|
|
|
123
123
|
执行以下命令安装 `TinyVue` 按需加载和打包的 `vite` 插件
|
|
124
124
|
|
|
@@ -12,6 +12,8 @@ TinyVue 是一个跨端、跨框架的企业级 UI 组件库,基于 OpenTiny D
|
|
|
12
12
|
- 📊 组件内部支持配置式开发,可支持低代码平台可视化组件配置
|
|
13
13
|
- 💡 采用模板、样式、逻辑分离的跨端、跨框架架构,保障灵活性和可移植性
|
|
14
14
|
|
|
15
|
+
组件 API / Demo 文档:[https://opentiny.design/tiny-vue](https://opentiny.design/tiny-vue)
|
|
16
|
+
|
|
15
17
|
## 🛠️ 核心亮点
|
|
16
18
|
|
|
17
19
|
### 1、一套代码同时支持 Vue 2 / Vue 3
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# TinyVue Agent Skills Usage Guide
|
|
2
|
+
|
|
3
|
+
TinyVue Agent Skills is a comprehensive toolkit designed for AI coding assistants. It enables these assistants to gain deep understanding of TinyVue component library usage, APIs, and best practices, thereby helping developers build applications more efficiently with TinyVue.
|
|
4
|
+
|
|
5
|
+
## What is TinyVue Skills?
|
|
6
|
+
|
|
7
|
+
The `tiny-vue-skill` is an official Agent Skill developed by OpenTiny that contains comprehensive TinyVue component documentation, practical examples, and detailed usage specifications. Once installed, your AI coding assistant (including Cursor, GitHub Copilot, Claude Code, and others) will be capable of:
|
|
8
|
+
|
|
9
|
+
- Accurately understand the APIs and properties of each TinyVue component
|
|
10
|
+
- Provide code examples that conform to TinyVue standards
|
|
11
|
+
- Intelligently recommend appropriate components for your business needs
|
|
12
|
+
- Help quickly build pages and features based on TinyVue
|
|
13
|
+
|
|
14
|
+
## Installation Methods
|
|
15
|
+
|
|
16
|
+
### Method 1: Install via Claude Code Plugin Marketplace (Recommended for Claude Code Users)
|
|
17
|
+
|
|
18
|
+
This method is ideal for Claude Code users and provides convenient one-click update functionality:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Add marketplace and install plugin after launching Claude Code
|
|
22
|
+
/plugin marketplace add https://github.com/opentiny/agent-skills
|
|
23
|
+
/plugin install tiny-vue-skill@opentiny-skills
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or run the following commands before launching:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
claude plugin marketplace add https://github.com/opentiny/agent-skills
|
|
30
|
+
claude plugin install tiny-vue-skill@opentiny-skills
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> **Marketplace Advantage**: Skills can be easily updated using the `claude plugin update` command.
|
|
34
|
+
|
|
35
|
+
### Method 2: Install via the `skills` Tool (Most Versatile Approach)
|
|
36
|
+
|
|
37
|
+
This method works with various AI coding tools and leverages npm for automated installation:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# List all available skills
|
|
41
|
+
npx skills add opentiny/agent-skills --list
|
|
42
|
+
|
|
43
|
+
# Install tiny-vue-skill globally (for Cursor)
|
|
44
|
+
npx skills add opentiny/agent-skills -g --skill tiny-vue-skill --agent cursor
|
|
45
|
+
|
|
46
|
+
# Install tiny-vue-skill at project level (for Cursor)
|
|
47
|
+
npx skills add opentiny/agent-skills --skill tiny-vue-skill --agent cursor
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**`--agent` Parameter Mapping for Different AI Tools:**
|
|
51
|
+
|
|
52
|
+
| AI Tool | `--agent` Parameter |
|
|
53
|
+
| -------------- | ------------------- |
|
|
54
|
+
| Cursor | `cursor` |
|
|
55
|
+
| Claude Code | `claude-code` |
|
|
56
|
+
| GitHub Copilot | `github-copilot` |
|
|
57
|
+
| Windsurf | `windsurf` |
|
|
58
|
+
| Gemini CLI | `gemini-cli` |
|
|
59
|
+
|
|
60
|
+
### Method 3: Manual Installation via Git Clone
|
|
61
|
+
|
|
62
|
+
**Step 1:** Clone the repository to your local machine:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/opentiny/agent-skills.git
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Step 2:** Copy the `skills/tiny-vue-skill` folder to your tool's Skills directory:
|
|
69
|
+
|
|
70
|
+
| AI Tool | Project-level Path | Global Path |
|
|
71
|
+
| -------------- | ------------------- | ----------------------------- |
|
|
72
|
+
| Cursor | `.cursor/skills/` | `~/.cursor/skills/` |
|
|
73
|
+
| Claude Code | `.claude/skills/` | `~/.claude/skills/` |
|
|
74
|
+
| GitHub Copilot | `.github/skills/` | `~/.copilot/skills/` |
|
|
75
|
+
| Windsurf | `.windsurf/skills/` | `~/.codeium/windsurf/skills/` |
|
|
76
|
+
|
|
77
|
+
## Enabling Skills in Cursor IDE
|
|
78
|
+
|
|
79
|
+
To enable Skills in Cursor IDE, press `Ctrl + ,` to open Settings, search for `useagentskills`, locate the experimental feature labeled **Use Agent Skills**, and enable it by checking the corresponding box.
|
|
80
|
+
|
|
81
|
+
## Usage Examples
|
|
82
|
+
|
|
83
|
+
Once you've installed and enabled the Skills, you can simply describe your requirements to the AI assistant. It will automatically reference TinyVue documentation to generate standardized code implementations:
|
|
84
|
+
|
|
85
|
+
**Example 1: Building a Data Grid Component**
|
|
86
|
+
|
|
87
|
+
> "Create a new Vue project and implement TinyVue's Grid component to build a Chinese provincial information query table. Include columns for serial number, province name, population, area, and GDP. Enable sorting functionality, freeze the province name column on the left side, and add a filter input field at the top of the table."
|
|
88
|
+
|
|
89
|
+
**Example 2: Implementing Dark Mode Support**
|
|
90
|
+
|
|
91
|
+
> "Add dark mode switching capability to the current TinyVue project, allowing users to toggle between light and dark themes seamlessly."
|
|
92
|
+
|
|
93
|
+
**Example 3: Creating a Registration Form**
|
|
94
|
+
|
|
95
|
+
> "Implement a user registration form using TinyVue's Form component with name, email, and password fields. Include comprehensive form validation to ensure data integrity and improve user experience."
|
|
96
|
+
|
|
97
|
+
## Keeping Skills Up to Date
|
|
98
|
+
|
|
99
|
+
Since the TinyVue component library is continuously evolving, we strongly recommend regular Skills updates to ensure you have access to the latest component documentation and features:
|
|
100
|
+
|
|
101
|
+
- **Claude Code Users**: Execute the `claude plugin update` command
|
|
102
|
+
- **Skills Tool Users**: Re-execute the installation command to overwrite and update existing installations
|
|
103
|
+
- **Manual Installation Users**: Pull the latest changes from the repository and copy the updated `tiny-vue-skill` folder
|
|
104
|
+
|
|
105
|
+
## Related Resources
|
|
106
|
+
|
|
107
|
+
- **GitHub Repository**: [opentiny/agent-skills](https://github.com/opentiny/agent-skills)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# TinyVue Agent Skills 使用指南
|
|
2
|
+
|
|
3
|
+
TinyVue Agent Skills 是一套面向 AI 编码助手的技能工具集,让 AI 助手深度理解 TinyVue 组件库的用法、API 和最佳实践,从而帮助您更高效地使用 TinyVue 开发应用。
|
|
4
|
+
|
|
5
|
+
## 什么是 TinyVue Skills?
|
|
6
|
+
|
|
7
|
+
`tiny-vue-skill` 是 OpenTiny 官方提供的 Agent Skill,包含了 TinyVue 组件的文档、示例和使用规范。安装后,您所使用的 AI 编码助手(如 Cursor、GitHub Copilot、Claude Code 等)将能够:
|
|
8
|
+
|
|
9
|
+
- 精准理解 TinyVue 各组件的 API 和属性
|
|
10
|
+
- 提供符合 TinyVue 规范的代码示例
|
|
11
|
+
- 智能推荐合适的组件解决业务需求
|
|
12
|
+
- 帮助快速搭建基于 TinyVue 的页面和功能
|
|
13
|
+
|
|
14
|
+
## 安装方式
|
|
15
|
+
|
|
16
|
+
### 方式一:通过 Claude Code 插件市场安装(Claude Code用户推荐)
|
|
17
|
+
|
|
18
|
+
适用于使用 Claude Code 的用户,支持后续一键更新:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 启动 Claude Code 后添加市场及插件
|
|
22
|
+
/plugin marketplace add https://github.com/opentiny/agent-skills
|
|
23
|
+
/plugin install tiny-vue-skill@opentiny-skills
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
或在未启动状态下执行:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
claude plugin marketplace add https://github.com/opentiny/agent-skills
|
|
30
|
+
claude plugin install tiny-vue-skill@opentiny-skills
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> 通过市场安装的优势:可使用 `claude plugin update` 命令轻松更新技能。
|
|
34
|
+
|
|
35
|
+
### 方式二:通过 `skills` 工具安装(推荐)
|
|
36
|
+
|
|
37
|
+
适用于多种 AI 编码工具,使用 npm 工具自动安装:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# 列出所有可用技能
|
|
41
|
+
npx skills add opentiny/agent-skills --list
|
|
42
|
+
|
|
43
|
+
# 全局安装 tiny-vue-skill(适用于 Cursor)
|
|
44
|
+
npx skills add opentiny/agent-skills -g --skill tiny-vue-skill --agent cursor
|
|
45
|
+
|
|
46
|
+
# 项目级安装 tiny-vue-skill(适用于 Cursor)
|
|
47
|
+
npx skills add opentiny/agent-skills --skill tiny-vue-skill --agent cursor
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
其他 AI 工具对应的 `--agent` 参数:
|
|
51
|
+
|
|
52
|
+
| AI 工具 | `--agent` 参数 |
|
|
53
|
+
| -------------- | ---------------- |
|
|
54
|
+
| Cursor | `cursor` |
|
|
55
|
+
| Claude Code | `claude-code` |
|
|
56
|
+
| GitHub Copilot | `github-copilot` |
|
|
57
|
+
| Windsurf | `windsurf` |
|
|
58
|
+
| Gemini CLI | `gemini-cli` |
|
|
59
|
+
|
|
60
|
+
### 方式三:手动克隆复制安装
|
|
61
|
+
|
|
62
|
+
1. 克隆仓库到本地:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/opentiny/agent-skills.git
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
2. 将 `skills/tiny-vue-skill` 文件夹复制到对应工具的 Skills 目录:
|
|
69
|
+
|
|
70
|
+
| AI 工具 | 项目内路径 | 全局路径 |
|
|
71
|
+
| -------------- | ------------------- | ----------------------------- |
|
|
72
|
+
| Cursor | `.cursor/skills/` | `~/.cursor/skills/` |
|
|
73
|
+
| Claude Code | `.claude/skills/` | `~/.claude/skills/` |
|
|
74
|
+
| GitHub Copilot | `.github/skills/` | `~/.copilot/skills/` |
|
|
75
|
+
| Windsurf | `.windsurf/skills/` | `~/.codeium/windsurf/skills/` |
|
|
76
|
+
|
|
77
|
+
## 在 Cursor 中启用 Skills
|
|
78
|
+
|
|
79
|
+
按快捷键 `Ctrl + ,` 打开设置界面,搜索 `useagentskills`,找到实验性功能 **Use Agent Skills**,勾选启用即可。
|
|
80
|
+
|
|
81
|
+
## 使用示例
|
|
82
|
+
|
|
83
|
+
安装并启用 Skills 后,您可以直接向 AI 助手描述需求,AI 将自动参考 TinyVue 文档生成标准的代码实现:
|
|
84
|
+
|
|
85
|
+
**示例 1:创建数据表格**
|
|
86
|
+
|
|
87
|
+
> 新建一个 Vue 工程,使用 TinyVue 的 Grid 组件开发一个中国省级信息查询表格,包含序号、省名、人口、面积、GDP 等列,支持排序,省名列固定在最左边,表格顶部有按省名过滤的功能。
|
|
88
|
+
|
|
89
|
+
**示例 2:开启深色模式**
|
|
90
|
+
|
|
91
|
+
> 为当前 TinyVue 工程增加深色模式切换能力。
|
|
92
|
+
|
|
93
|
+
**示例 3:使用表单组件**
|
|
94
|
+
|
|
95
|
+
> 使用 TinyVue 的 Form 组件创建一个用户注册表单,包含姓名、邮箱、密码字段,并添加表单校验。
|
|
96
|
+
|
|
97
|
+
## 保持 Skills 更新
|
|
98
|
+
|
|
99
|
+
TinyVue 组件库持续迭代,建议定期更新 Skills 以获取最新的组件文档:
|
|
100
|
+
|
|
101
|
+
- **Claude Code 用户**:执行 `claude plugin update` 命令
|
|
102
|
+
- **`skills` 工具用户**:重新执行安装命令覆盖更新
|
|
103
|
+
- **手动安装用户**:重新拉取仓库并复制最新的 `tiny-vue-skill` 文件夹
|
|
104
|
+
|
|
105
|
+
## 相关资源
|
|
106
|
+
|
|
107
|
+
- [opentiny/agent-skills GitHub 仓库](https://github.com/opentiny/agent-skills)
|
|
@@ -6,20 +6,19 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
A set of global CSS variables is defined in the TinyVue component library to unify theme styles, such as fonts, colors, spacing, and rounding values, and component-level CSS variables are also defined within each component. Starting with the <code> @opentiny/vue@3.19.0 </code> version, the overall style of the component library is changed to a new 'Opentiny Design' style, which is more suitable for enterprise-class and background management applications. If you want to use the OLD theme style, you can choose to continue using the historical version, or refer to the current document's <a href='#OLD theme configuration '>OLD theme configuration </a>.
|
|
9
|
+
A comprehensive set of global CSS variables is defined in the TinyVue component library to unify theme styles, including fonts, colors, spacing, and rounding values. Additionally, component-level CSS variables are defined within each individual component. Starting from version <code>@opentiny/vue@3.19.0</code>, the component library's overall style has been updated to the new 'Opentiny Design' style, which is specifically tailored for enterprise-class applications and backend management systems. If you prefer to use the legacy theme style, you can continue using the historical version or refer to the <a href='#old-theme-configuration'>OLD Theme Configuration</a> section in this document.
|
|
11
10
|
|
|
12
|
-
-
|
|
11
|
+
- Global CSS variables are located in the 'base' directory of the theme package: [base/vars.less](https://github.com/opentiny/tiny-vue/blob/dev/packages/theme/src/base/vars.less)
|
|
13
12
|
|
|
14
|
-
- Component-level
|
|
13
|
+
- Component-level CSS variables are defined in the theme root directory of each component, such as [button/vars.less](https://github.com/opentiny/tiny-vue/blob/dev/packages/theme/src/button/vars.less)
|
|
15
14
|
|
|
16
|
-
By
|
|
15
|
+
By examining the source code above, you can identify which component library styles can be customized.
|
|
17
16
|
|
|
18
|
-
## Custom
|
|
17
|
+
## Custom Theme
|
|
19
18
|
|
|
20
|
-
In
|
|
19
|
+
In your project, if you need to customize the theme style or override specific component styles, you can configure the project theme using the 'TinyThemeTool' class provided by the component library. We will continue to provide additional theme options for you to choose from in the future.
|
|
21
20
|
|
|
22
|
-
'ThemeData' is a custom theme data format that allows users to pass
|
|
21
|
+
'ThemeData' is a custom theme data format that allows users to pass overridden global CSS variables through the 'data' property and valid CSS rule blocks through the 'css' property.
|
|
23
22
|
|
|
24
23
|
```ts
|
|
25
24
|
interface ThemeData {
|
|
@@ -79,9 +78,9 @@ themeTool.changeTheme({
|
|
|
79
78
|
</div>
|
|
80
79
|
</div>
|
|
81
80
|
|
|
82
|
-
## Micro Frontends
|
|
81
|
+
## Micro Frontends Scenario
|
|
83
82
|
|
|
84
|
-
By default, the 'themeTool.changeTheme' method
|
|
83
|
+
By default, the 'themeTool.changeTheme' method mounts custom styles to the current 'document'. However, in micro frontend frameworks, there is typically a style isolation mechanism in place. For instance, an unbounded micro frontend may encapsulate child applications within a 'Web Component'. When customizing themes in such scenarios, you must mount the styles to the 'ShadowRoot' of the sub-application.
|
|
85
84
|
|
|
86
85
|
```ts
|
|
87
86
|
import TinyThemeTool from '@opentiny/vue-theme/theme-tool'
|
|
@@ -103,60 +102,60 @@ themeTool.changeTheme(
|
|
|
103
102
|
)
|
|
104
103
|
```
|
|
105
104
|
|
|
106
|
-
## OLD
|
|
105
|
+
## OLD Theme Configuration
|
|
107
106
|
|
|
108
|
-
We do not recommend that users continue
|
|
107
|
+
We do not recommend that users continue using the old theme. However, for legacy projects, we provide a set of old theme 'CSS variables' that users need to adapt in their projects.
|
|
109
108
|
|
|
110
109
|
```ts
|
|
111
110
|
import TinyThemeTool, { OldTheme } from '@opentiny/vue-theme/theme-tool'
|
|
112
111
|
|
|
113
112
|
const themeTool = new TinyThemeTool(OldTheme)
|
|
114
113
|
|
|
115
|
-
// themeTool.changeTheme(OldTheme) //
|
|
114
|
+
// themeTool.changeTheme(OldTheme) // Same effect as above
|
|
116
115
|
```
|
|
117
116
|
|
|
118
117
|
<div class="warning custom-block">
|
|
119
|
-
|
|
118
|
+
The old theme cannot 100% replicate all details of historical versions. If users experience significant impacts after upgrading, they can provide feedback to us. Alternatively, you can roll back to version <code>@opentiny/vue@3.18.0</code>, which we will continue to maintain for some time.
|
|
120
119
|
</div>
|
|
121
120
|
|
|
122
|
-
## Historical
|
|
121
|
+
## Historical Version Theme Configuration
|
|
123
122
|
|
|
124
123
|
<div class="danger custom-block">
|
|
125
|
-
|
|
124
|
+
This section of the documentation only supports theme customization for versions prior to <code>@opentiny/vue@3.18.0</code>
|
|
126
125
|
</div>
|
|
127
126
|
|
|
128
|
-
The `TinyVue`
|
|
127
|
+
The `TinyVue` component library utilizes `css` variables and defines a series of global/component style variables that you can adjust according to your specific requirements.
|
|
129
128
|
|
|
130
|
-
|
|
129
|
+
To view the theme-related variables, follow these steps:
|
|
131
130
|
|
|
132
131
|
Source code: [basic-var.less](https://github.com/opentiny/tiny-vue-theme/blob/main/src/base/basic-var.less)
|
|
133
132
|
|
|
134
|
-
Design
|
|
133
|
+
Design documentation: [Administrative interface specification design variables](https://rnd-think.huawei.com/think-home/designAnnotation)
|
|
135
134
|
|
|
136
|
-
Basic style variable `npm`
|
|
135
|
+
Basic style variable `npm` repository path: `@opentiny/vue-theme/theme`
|
|
137
136
|
|
|
138
|
-
### Using
|
|
137
|
+
### Using Predefined Themes and Dynamic Theme Switching
|
|
139
138
|
|
|
140
|
-
|
|
139
|
+
The official distribution currently offers 4 theme sets:
|
|
141
140
|
|
|
142
|
-
-Default Theme
|
|
143
|
-
-Infinity Theme `tinyInfinityTheme`
|
|
144
|
-
-Aurora Theme `tinyAuroraTheme`
|
|
145
|
-
-XDesign Theme `tinySmbTheme`
|
|
141
|
+
- Default Theme
|
|
142
|
+
- Infinity Theme `tinyInfinityTheme`
|
|
143
|
+
- Aurora Theme `tinyAuroraTheme`
|
|
144
|
+
- XDesign Theme `tinySmbTheme`
|
|
146
145
|
|
|
147
|
-
#### Using
|
|
146
|
+
#### Using Predefined Themes Through Alias [Currently supporting: Aurora theme and XDesign theme]
|
|
148
147
|
|
|
149
|
-
vue.config.js
|
|
148
|
+
**vue.config.js configuration:**
|
|
150
149
|
|
|
151
150
|
```js
|
|
152
151
|
chainWebpack: (config) => {
|
|
153
152
|
// XDesign Theme
|
|
154
153
|
config.resolve.alias.set('@opentiny/vue-theme', '@opentiny/vue-theme/smb-theme')
|
|
155
|
-
// Aurora Theme
|
|
154
|
+
// Aurora Theme: Replace all 'smb' characters in the above SMB theme with 'aurora'
|
|
156
155
|
}
|
|
157
156
|
```
|
|
158
157
|
|
|
159
|
-
vite.config.js
|
|
158
|
+
**vite.config.js configuration:**
|
|
160
159
|
|
|
161
160
|
```js
|
|
162
161
|
resolve: {
|
|
@@ -170,33 +169,34 @@ resolve: {
|
|
|
170
169
|
}
|
|
171
170
|
```
|
|
172
171
|
|
|
173
|
-
####
|
|
172
|
+
#### Theme Initialization and Dynamic Switching Implementation
|
|
173
|
+
|
|
174
|
+
Add the following code to your main.ts file:
|
|
174
175
|
|
|
175
176
|
```js
|
|
176
|
-
import TinyThemeTool from '
|
|
177
|
+
import TinyThemeTool from '@opentiny/vue-theme/theme-tool'
|
|
177
178
|
|
|
178
|
-
//
|
|
179
|
+
// Import Infinity theme
|
|
179
180
|
import { tinyInfinityTheme } from '@opentiny/vue-theme/theme'
|
|
180
181
|
|
|
181
|
-
// Initialize the
|
|
182
|
+
// Initialize the infinity theme
|
|
182
183
|
const theme = new TinyThemeTool(tinyInfinityTheme, 'tinyStyleSheetId')
|
|
183
184
|
|
|
184
|
-
//
|
|
185
|
+
// Custom theme data format
|
|
185
186
|
const tinyTestTheme = {
|
|
186
|
-
id: 'tiny-test-theme', // Unique
|
|
187
|
-
name: 'testTheme', // English name
|
|
188
|
-
cnName: 'Test
|
|
189
|
-
data: { 'ti-base-color': '#f2f2f3' } //
|
|
187
|
+
id: 'tiny-test-theme', // Unique theme identifier - each theme must have a unique ID
|
|
188
|
+
name: 'testTheme', // English theme name
|
|
189
|
+
cnName: 'Test Theme', // Chinese theme name
|
|
190
|
+
data: { 'ti-base-color': '#f2f2f3' } // Theme data
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
// Dynamic theme switching
|
|
193
|
-
|
|
194
194
|
theme.changeTheme(tinyTestTheme)
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
### Advanced
|
|
197
|
+
### Advanced Theme Customization Techniques
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
Define custom CSS variables at the global scope:
|
|
200
200
|
|
|
201
201
|
```css
|
|
202
202
|
:root {
|
|
@@ -204,7 +204,7 @@ Add a custom `css` variable under the global scope.
|
|
|
204
204
|
}
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
For performance
|
|
207
|
+
For better performance, it's recommended to define custom CSS variables under specific class names rather than at the global :root level:
|
|
208
208
|
|
|
209
209
|
```css
|
|
210
210
|
.tiny-test-class {
|
|
@@ -212,83 +212,86 @@ For performance reasons, it is more recommended that you add custom `css` variab
|
|
|
212
212
|
}
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
To customize a specific component, you can apply inline styles directly:
|
|
216
216
|
|
|
217
|
-
```
|
|
217
|
+
```html
|
|
218
218
|
<tiny-button style="--ti-base-color-white: #fefefe">Button</tiny-button>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
To control CSS variables through JavaScript:
|
|
222
222
|
|
|
223
223
|
```js
|
|
224
224
|
const el = document.documentElement
|
|
225
225
|
|
|
226
|
-
//
|
|
226
|
+
// Retrieve CSS variable value
|
|
227
227
|
getComputedStyle(el).getPropertyValue('--ti-base-color-white')
|
|
228
228
|
|
|
229
|
-
// Set
|
|
229
|
+
// Set CSS variable value
|
|
230
230
|
el.style.setProperty('--ti-base-color-white', '#fefefe')
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
### Theme
|
|
234
|
-
|
|
235
|
-
Background: Because the `tiny-vue` needs to connect to the theme-based configuration system, the `tiny-vue` component library is later than the `3.5. 0` version, and the name of the customized variable is changed.
|
|
233
|
+
### Standardizing Theme Variables: Old vs New Variable Names
|
|
236
234
|
|
|
237
|
-
|
|
235
|
+
**Background**: As `tiny-vue` integrates with theme-based configuration systems, component library versions later than `3.5.0` have undergone variable name changes to standardize the naming convention.
|
|
238
236
|
|
|
239
|
-
|
|
237
|
+
For example:
|
|
240
238
|
|
|
241
|
-
|
|
239
|
+
- `--ti-base-color-selected-font-color` has been renamed to `--ti-base-color-selected-text-color`
|
|
240
|
+
- `--ti-alert-radius` has been renamed to `--ti-alert-border-radius`
|
|
242
241
|
|
|
243
|
-
|
|
242
|
+
When upgrading projects that use old CSS variables for styling, the new `tiny-vue` version may not recognize these variables. To address this, we provide a batch variable name replacement method. The process is as follows:
|
|
244
243
|
|
|
245
|
-
|
|
246
|
-
import { pubUrl } from '@/tools'
|
|
247
|
-
</script>
|
|
244
|
+
**Step 1**: Download the mapping table `newVars.json` and replacement script `replaceVar.js`.
|
|
248
245
|
|
|
249
|
-
|
|
246
|
+
[Download newVars.json](newVars.json) and [Download replaceVar.js](replaceVar.js)
|
|
250
247
|
|
|
251
|
-
Step 2
|
|
248
|
+
**Step 2**: Place both `newVars.json` and `replaceVar.js` in your project's root directory (at the same level as the src directory).
|
|
252
249
|
|
|
253
|
-
|
|
250
|
+
**Step 3**: Execute the following command in your project's root directory:
|
|
254
251
|
|
|
255
|
-
|
|
252
|
+
```bash
|
|
253
|
+
node replaceVar.js
|
|
254
|
+
```
|
|
256
255
|
|
|
257
|
-
|
|
256
|
+
**Handling Special Cases**: Manual replacement may be required for certain variables.
|
|
258
257
|
|
|
259
|
-
|
|
258
|
+
**Manual Replacement Background**: In the `newVars.json` mapping table, each `key` represents an old variable name and its corresponding `value` represents the new variable name. Some old variables like `--ti-button-padding` are classified as "special variables" because they are split into two or more new variables, making their `value` an array. In such cases, the script cannot perform automatic replacement, requiring manual intervention.
|
|
260
259
|
|
|
261
|
-
|
|
260
|
+
**Manual Replacement Process**:
|
|
262
261
|
|
|
263
|
-
|
|
262
|
+
1. Uncomment line 20 in the replaceVar.js file and re-run step 3. This will identify which variables require manual replacement (refer to the special variables table at the end of this document).
|
|
264
263
|
|
|
265
264
|
```js
|
|
266
|
-
|
|
265
|
+
console.log('Files requiring manual replacement:', statPath, 'Variables to replace:', key)
|
|
267
266
|
```
|
|
268
267
|
|
|
269
|
-
|
|
268
|
+
2. Based on the output file paths and variables, locate and modify the variables accordingly. The following examples cover all scenarios requiring manual replacement:
|
|
270
269
|
|
|
271
|
-
|
|
270
|
+
**General Cases**:
|
|
272
271
|
|
|
273
|
-
Example 1
|
|
272
|
+
**Example 1**: The special variables table shows that the old variable `--ti-button-padding` is split into 2 new variables: `--ti-button-padding-vertical` and `--ti-button-padding-horizontal`, representing vertical and horizontal padding respectively.
|
|
274
273
|
|
|
275
|
-
|
|
274
|
+
Original style: `padding: var(--ti-button-padding);`
|
|
275
|
+
Manual replacement: `padding: var(--ti-button-padding-vertical) var(--ti-button-padding-horizontal);`
|
|
276
276
|
|
|
277
|
-
Example 2
|
|
277
|
+
**Example 2**: The old variable `--ti-pager-primary-color` is split into 3 new variables: `--ti-pager-primary-bg-color`, `--ti-pager-primary-text-color`, and `--ti-pager-primary-border-color`, representing background color, text color, and border color respectively.
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
Original format: `--ti-pager-primary-color: red;`
|
|
280
|
+
Manual replacement: `--ti-pager-primary-bg-color: red; --ti-pager-primary-text-color: red; --ti-pager-primary-border-color: red;`
|
|
280
281
|
|
|
281
|
-
|
|
282
|
+
**Special Circumstances**:
|
|
282
283
|
|
|
283
|
-
Example 3
|
|
284
|
+
**Example 3**: Variables containing the `border` field require special handling. When split, they contain `border-weight` (border thickness), `border-style` (border style), and `border-color` (border color). For instance, `--tv-Tabs-item-active-border` splits into `--tv-Tabs-item-active-border-weight`, `--tv-Tabs-item-active-border-style`, and `--tv-Tabs-item-active-border-color`.
|
|
284
285
|
|
|
285
|
-
|
|
286
|
+
Original style: `--tv-Tabs-item-active-border: 1px solid red;`
|
|
287
|
+
Manual replacement: `--tv-Tabs-item-active-border-weight: 1px; --tv-Tabs-item-active-border-style: solid; --tv-Tabs-item-active-border-color: red;`
|
|
286
288
|
|
|
287
|
-
Example 4
|
|
289
|
+
**Example 4**: When a variable split from `--ti-radio-button-checked-hover-color` contains the `box-shadow` field, the `box-shadow` style must be written separately.
|
|
288
290
|
|
|
289
|
-
|
|
291
|
+
Original format: `--ti-radio-button-checked-hover-color: red`
|
|
292
|
+
Manual replacement: `--ti-radio-button-checked-hover-bg-color: red; --ti-radio-button-checked-hover-border-color: red; --ti-radio-button-checked-hover-box-shadow: -1px 0 0 0 red;` (The box-shadow value follows standard CSS syntax and can be customized.)
|
|
290
293
|
|
|
291
|
-
The mapping table of special variables is
|
|
294
|
+
The complete mapping table of special variables is provided below. The newVars.json file contains 48 special variables as shown in the following structure.
|
|
292
295
|
|
|
293
296
|
```json
|
|
294
297
|
{
|