@vrojs/base 0.0.1 → 0.0.3

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.
Files changed (123) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.js +37 -0
  3. package/dist/style/css.js +4 -0
  4. package/dist/style/index.css +1 -0
  5. package/dist/style/index.d.ts +0 -0
  6. package/dist/style/index.js +4 -0
  7. package/dist/types/Arrayable.d.ts +1 -0
  8. package/dist/types/Arrayable.js +1 -0
  9. package/dist/types/DeepPartial.d.ts +3 -0
  10. package/dist/types/DeepPartial.js +1 -0
  11. package/dist/types/index.d.ts +2 -0
  12. package/dist/types/index.js +1 -0
  13. package/dist/utils/ComponentManager.d.ts +18 -0
  14. package/dist/utils/ComponentManager.js +21 -0
  15. package/dist/utils/format.d.ts +5 -0
  16. package/dist/utils/format.js +14 -0
  17. package/dist/utils/getSlotEntries.d.ts +5 -0
  18. package/dist/utils/getSlotEntries.js +4 -0
  19. package/dist/utils/index.d.ts +9 -0
  20. package/dist/utils/index.js +21 -0
  21. package/dist/utils/mountComponent.d.ts +5 -0
  22. package/dist/utils/mountComponent.js +12 -0
  23. package/dist/utils/parseType.d.ts +1 -0
  24. package/dist/utils/parseType.js +4 -0
  25. package/dist/utils/props.d.ts +2 -0
  26. package/dist/utils/props.js +5 -0
  27. package/dist/utils/renderComponent.d.ts +5 -0
  28. package/dist/utils/renderComponent.js +17 -0
  29. package/dist/utils/showComponent.d.ts +6 -0
  30. package/dist/utils/showComponent.js +17 -0
  31. package/dist/utils/withInstall.d.ts +3 -0
  32. package/dist/utils/withInstall.js +6 -0
  33. package/dist/vro-aspect-ratio/index.d.ts +46 -0
  34. package/dist/vro-aspect-ratio/index.js +11 -0
  35. package/dist/vro-aspect-ratio/style/css.d.ts +0 -0
  36. package/dist/vro-aspect-ratio/style/css.js +4 -0
  37. package/dist/vro-aspect-ratio/style/index.css +1 -0
  38. package/dist/vro-aspect-ratio/style/index.d.ts +0 -0
  39. package/dist/vro-aspect-ratio/style/index.js +4 -0
  40. package/dist/vro-aspect-ratio/types.d.ts +13 -0
  41. package/dist/vro-aspect-ratio/types.js +14 -0
  42. package/dist/vro-aspect-ratio/vro-aspect-ratio.vue.d.ts +29 -0
  43. package/dist/vro-aspect-ratio/vro-aspect-ratio.vue.js +25 -0
  44. package/dist/vro-aspect-ratio/vro-aspect-ratio.vue2.js +4 -0
  45. package/dist/vro-input/index.d.ts +90 -0
  46. package/dist/vro-input/index.js +11 -0
  47. package/dist/vro-input/style/css.d.ts +0 -0
  48. package/dist/vro-input/style/css.js +3 -0
  49. package/dist/vro-input/style/index.d.ts +0 -0
  50. package/dist/vro-input/style/index.js +3 -0
  51. package/dist/vro-input/types.d.ts +95 -0
  52. package/{src/vro-input/types.ts → dist/vro-input/types.js} +17 -30
  53. package/dist/vro-input/vro-input.vue.d.ts +83 -0
  54. package/dist/vro-input/vro-input.vue.js +62 -0
  55. package/dist/vro-input/vro-input.vue2.js +4 -0
  56. package/dist/vro-loading/index.d.ts +91 -0
  57. package/dist/vro-loading/index.js +11 -0
  58. package/dist/vro-loading/style/css.d.ts +0 -0
  59. package/dist/vro-loading/style/css.js +4 -0
  60. package/dist/vro-loading/style/index.css +1 -0
  61. package/dist/vro-loading/style/index.d.ts +0 -0
  62. package/dist/vro-loading/style/index.js +4 -0
  63. package/dist/vro-loading/types.d.ts +33 -0
  64. package/dist/vro-loading/types.js +33 -0
  65. package/dist/vro-loading/vro-loading.vue.d.ts +56 -0
  66. package/dist/vro-loading/vro-loading.vue.js +50 -0
  67. package/dist/vro-loading/vro-loading.vue2.js +4 -0
  68. package/dist/vro-vnr/index.d.ts +25 -0
  69. package/dist/vro-vnr/index.js +11 -0
  70. package/dist/vro-vnr/style/css.d.ts +0 -0
  71. package/dist/vro-vnr/style/css.js +3 -0
  72. package/dist/vro-vnr/style/index.d.ts +0 -0
  73. package/dist/vro-vnr/style/index.js +3 -0
  74. package/dist/vro-vnr/types.d.ts +8 -0
  75. package/dist/vro-vnr/types.js +9 -0
  76. package/dist/vro-vnr/vro-vnr.vue.d.ts +18 -0
  77. package/dist/vro-vnr/vro-vnr.vue.js +12 -0
  78. package/dist/vro-vnr/vro-vnr.vue2.js +4 -0
  79. package/package.json +16 -10
  80. package/src/index.ts +0 -8
  81. package/src/style/base.scss +0 -2
  82. package/src/style/css.ts +0 -2
  83. package/src/style/index.scss +0 -7
  84. package/src/style/index.ts +0 -1
  85. package/src/types/Arrayable.ts +0 -1
  86. package/src/types/DeepPartial.ts +0 -3
  87. package/src/types/index.ts +0 -2
  88. package/src/utils/ComponentManager.ts +0 -39
  89. package/src/utils/format.ts +0 -31
  90. package/src/utils/index.ts +0 -8
  91. package/src/utils/mountComponent.ts +0 -16
  92. package/src/utils/parseType.ts +0 -6
  93. package/src/utils/props.ts +0 -3
  94. package/src/utils/renderComponent.ts +0 -24
  95. package/src/utils/showComponent.ts +0 -24
  96. package/src/utils/withInstall.ts +0 -10
  97. package/src/vro-aspect-ratio/README.md +0 -55
  98. package/src/vro-aspect-ratio/index.ts +0 -15
  99. package/src/vro-aspect-ratio/style/css.ts +0 -2
  100. package/src/vro-aspect-ratio/style/index.scss +0 -16
  101. package/src/vro-aspect-ratio/style/index.ts +0 -1
  102. package/src/vro-aspect-ratio/types.ts +0 -15
  103. package/src/vro-aspect-ratio/vro-aspect-ratio.vue +0 -23
  104. package/src/vro-input/README.md +0 -95
  105. package/src/vro-input/index.ts +0 -15
  106. package/src/vro-input/style/css.ts +0 -2
  107. package/src/vro-input/style/index.ts +0 -1
  108. package/src/vro-input/vro-input.vue +0 -122
  109. package/src/vro-loading/README.md +0 -77
  110. package/src/vro-loading/index.ts +0 -15
  111. package/src/vro-loading/style/css.ts +0 -2
  112. package/src/vro-loading/style/index.scss +0 -119
  113. package/src/vro-loading/style/index.ts +0 -1
  114. package/src/vro-loading/types.ts +0 -39
  115. package/src/vro-loading/vro-loading.vue +0 -39
  116. package/src/vro-vnr/README.md +0 -46
  117. package/src/vro-vnr/index.ts +0 -15
  118. package/src/vro-vnr/style/css.ts +0 -2
  119. package/src/vro-vnr/style/index.ts +0 -1
  120. package/src/vro-vnr/types.ts +0 -10
  121. package/src/vro-vnr/vro-vnr.vue +0 -13
  122. /package/{src/vro-input/style/index.scss → dist/style/base.css} +0 -0
  123. /package/{src/vro-vnr/style/index.scss → dist/style/css.d.ts} +0 -0
@@ -0,0 +1,25 @@
1
+ export * from './types';
2
+ export declare const VroVnr: import('..').WithInstall<import('vue').DefineComponent<import('vue').ExtractPropTypes<{
3
+ nodes: {
4
+ type: import('vue').PropType<import('vue').VNode[]>;
5
+ default: () => never[];
6
+ };
7
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
8
+ [key: string]: any;
9
+ }>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ nodes: {
11
+ type: import('vue').PropType<import('vue').VNode[]>;
12
+ default: () => never[];
13
+ };
14
+ }>> & Readonly<{}>, {
15
+ nodes: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
16
+ [key: string]: any;
17
+ }>[];
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>>;
19
+ export default VroVnr;
20
+ export type VroVnrInstance = InstanceType<typeof VroVnr>;
21
+ declare module 'vue' {
22
+ interface GlobalComponents {
23
+ VroVnr: typeof VroVnr;
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ import "@daysnap/utils";
2
+ import "vue";
3
+ import { withInstall as r } from "../utils/withInstall.js";
4
+ import o from "./vro-vnr.vue.js";
5
+ import { vroVnrProps as a } from "./types.js";
6
+ const f = r(o);
7
+ export {
8
+ f as VroVnr,
9
+ f as default,
10
+ a as vroVnrProps
11
+ };
File without changes
@@ -0,0 +1,3 @@
1
+ import '../../style/base.css';
2
+ /* empty css */
3
+ /* empty css */
File without changes
@@ -0,0 +1,3 @@
1
+ import '../../style/base.css';
2
+ /* empty css */
3
+ /* empty css */
@@ -0,0 +1,8 @@
1
+ import { ExtractPropTypes, PropType, VNode } from 'vue';
2
+ export declare const vroVnrProps: {
3
+ nodes: {
4
+ type: PropType<VNode[]>;
5
+ default: () => never[];
6
+ };
7
+ };
8
+ export type VroVnrProps = ExtractPropTypes<typeof vroVnrProps>;
@@ -0,0 +1,9 @@
1
+ const r = {
2
+ nodes: {
3
+ type: Array,
4
+ default: () => []
5
+ }
6
+ };
7
+ export {
8
+ r as vroVnrProps
9
+ };
@@ -0,0 +1,18 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ nodes: {
3
+ type: import('vue').PropType<import('vue').VNode[]>;
4
+ default: () => never[];
5
+ };
6
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
7
+ [key: string]: any;
8
+ }>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
9
+ nodes: {
10
+ type: import('vue').PropType<import('vue').VNode[]>;
11
+ default: () => never[];
12
+ };
13
+ }>> & Readonly<{}>, {
14
+ nodes: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
15
+ [key: string]: any;
16
+ }>[];
17
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
18
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import { defineComponent as r } from "vue";
2
+ import { vroVnrProps as n } from "./types.js";
3
+ const t = r({
4
+ name: "VroVnr",
5
+ props: n,
6
+ setup(o) {
7
+ return () => o.nodes;
8
+ }
9
+ });
10
+ export {
11
+ t as default
12
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./vro-vnr.vue.js";
2
+ export {
3
+ f as default
4
+ };
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@vrojs/base",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "vrojs ui",
5
- "main": "src/index.ts",
6
- "types": "src/index.ts",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
7
9
  "files": [
8
- "src",
9
- "!src/**/demo",
10
- "!src/**/README.md"
10
+ "dist"
11
11
  ],
12
12
  "sideEffects": [
13
- "src/**/style/*"
13
+ "dist/**/style/*",
14
+ "dist/**/*.css"
14
15
  ],
15
16
  "keywords": [
16
17
  "vro",
@@ -27,17 +28,22 @@
27
28
  "peerDependencies": {
28
29
  "@daysnap/utils": ">=0.1.34",
29
30
  "vue": ">=3.0.0",
30
- "@vrojs/use": "0.0.1"
31
+ "@vrojs/use": "0.0.2"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@daysnap/utils": "^0.1.34",
35
+ "@vitejs/plugin-vue": "^6.0.1",
34
36
  "rimraf": "^6.0.1",
35
37
  "typescript": "^5.9.3",
38
+ "vite": "^7.1.12",
39
+ "vite-plugin-dts": "^4.5.4",
36
40
  "vue": "^3.5.22",
37
- "@vrojs/use": "0.0.1"
41
+ "@vrojs/use": "0.0.2"
38
42
  },
39
43
  "scripts": {
40
- "release": "dsc publish --pnpm",
44
+ "build": "npm run clean && vite build",
45
+ "clean": "rimraf ./dist",
46
+ "release": "npm run build && dsc publish --pnpm",
41
47
  "sync": "dsc sync"
42
48
  }
43
49
  }
package/src/index.ts DELETED
@@ -1,8 +0,0 @@
1
- /* 本文件自动生成 './scripts/index.ts' */
2
-
3
- export * from './types'
4
- export * from './utils'
5
- export * from './vro-aspect-ratio'
6
- export * from './vro-input'
7
- export * from './vro-loading'
8
- export * from './vro-vnr'
@@ -1,2 +0,0 @@
1
- :root {
2
- }
package/src/style/css.ts DELETED
@@ -1,2 +0,0 @@
1
- import './base.scss'
2
- import './index.scss'
@@ -1,7 +0,0 @@
1
- /* 本文件自动生成 './scripts/index.ts' */
2
-
3
- @use './base.scss' as *;
4
- @use '../vro-aspect-ratio/style/index.scss' as *;
5
- @use '../vro-input/style/index.scss' as *;
6
- @use '../vro-loading/style/index.scss' as *;
7
- @use '../vro-vnr/style/index.scss' as *;
@@ -1 +0,0 @@
1
- import './css'
@@ -1 +0,0 @@
1
- export type Arrayable<T> = T | T[]
@@ -1,3 +0,0 @@
1
- export type DeepPartial<T> = {
2
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]
3
- }
@@ -1,2 +0,0 @@
1
- export type * from './Arrayable'
2
- export type * from './DeepPartial'
@@ -1,39 +0,0 @@
1
- import { isFunction } from '@daysnap/utils'
2
-
3
- type Constructor = abstract new (...args: any) => any
4
-
5
- export type InstanceTypeProps<T extends Constructor> = InstanceType<T>['$props']
6
-
7
- export type ComponentManagerMapValue<T extends Constructor = any> =
8
- | {
9
- is: T
10
- props: InstanceTypeProps<T>
11
- }
12
- | { is: string; props: Record<string, any> }
13
-
14
- export class ComponentManager {
15
- map: Record<string, ComponentManagerMapValue> = {}
16
-
17
- add(name: string, props?: Record<string, any>): ComponentManager
18
- add<T extends Constructor>(name: string, is: T, props?: InstanceTypeProps<T>): ComponentManager
19
- add<T extends Constructor>(name: string, is?: any, props?: InstanceTypeProps<T>) {
20
- if (isFunction(is.setup)) {
21
- this.map[name] = { is, props: props ?? {} }
22
- } else {
23
- this.map[name] = { is: name, props: is ?? {} }
24
- }
25
- return this
26
- }
27
-
28
- get(name: string) {
29
- return this.map[name]
30
- }
31
-
32
- del(name: string) {
33
- delete this.map[name]
34
- }
35
-
36
- clear() {
37
- this.map = {}
38
- }
39
- }
@@ -1,31 +0,0 @@
1
- export function parseNumberString(val: string) {
2
- return val.replace(/[^\d]/g, '')
3
- }
4
-
5
- export function parseDecimalString(
6
- val: string,
7
- options: { precision?: number; allowNegativeNumber?: boolean } = {},
8
- ) {
9
- const { precision = 0, allowNegativeNumber = true } = options
10
-
11
- // const reg = new RegExp(`^-?(0|[1-9]\\d*)?(\\.\\d{0,${precision}})?`, 'g')
12
- const reg = new RegExp(
13
- `^${allowNegativeNumber ? '-?' : ''}(0|[1-9]\\d*)?${+precision === 0 ? '' : `(\\.?\\d{0,${precision}})?`}`,
14
- 'g',
15
- )
16
-
17
- val = val.match(reg)?.[0] ?? ''
18
-
19
- // 特殊情况、特殊处理
20
- if (val.startsWith('-00')) {
21
- val = `-0`
22
- } else if (val.startsWith('-.')) {
23
- val = '-'
24
- } else if (val.startsWith('.')) {
25
- val = ''
26
- } else if (val.startsWith('0') && !val.startsWith('0.') && val.length > 1) {
27
- val = `${+val}`
28
- }
29
-
30
- return val
31
- }
@@ -1,8 +0,0 @@
1
- export * from './ComponentManager'
2
- export * from './format'
3
- export * from './mountComponent'
4
- export * from './parseType'
5
- export * from './props'
6
- export * from './renderComponent'
7
- export * from './showComponent'
8
- export * from './withInstall'
@@ -1,16 +0,0 @@
1
- import { type Component, createApp } from 'vue'
2
-
3
- export function mountComponent(component: Component, props?: any) {
4
- const root = document.createElement('div')
5
- document.body.appendChild(root)
6
-
7
- const instance = createApp(component, props)
8
- instance.mount(root)
9
-
10
- const destroy = () => {
11
- instance.unmount()
12
- document.body.removeChild(root)
13
- }
14
-
15
- return { instance, destroy }
16
- }
@@ -1,6 +0,0 @@
1
- export const parseType = (value: any) => {
2
- if (Array.isArray(value)) {
3
- return value.map((item) => item?.name).join(' , ')
4
- }
5
- return value?.name
6
- }
@@ -1,3 +0,0 @@
1
- import { PropType } from 'vue'
2
-
3
- export const definePropType = <T>(val: any): PropType<T> => val
@@ -1,24 +0,0 @@
1
- import { type AppContext, type Component, createVNode, render } from 'vue'
2
-
3
- export function renderComponent(
4
- component: Component,
5
- props: any = {},
6
- appContext: AppContext | null = null,
7
- ) {
8
- const container = document.createElement('div')
9
- document.body.appendChild(container)
10
-
11
- const vnode = createVNode(component, props)
12
- vnode.appContext = appContext
13
- render(vnode, container)
14
-
15
- const destroy = () => {
16
- render(null, container)
17
- document.body.removeChild(container)
18
- }
19
-
20
- return {
21
- instance: vnode.component!,
22
- destroy,
23
- }
24
- }
@@ -1,24 +0,0 @@
1
- import type { AppContext, Component } from 'vue'
2
-
3
- import { renderComponent } from './renderComponent'
4
-
5
- export function showComponent<
6
- T extends Component,
7
- P = T extends { new (): { $props: infer Props } } ? Props : Record<string, any>,
8
- >(component: T, props: Partial<P>, appContext: AppContext | null = null) {
9
- return new Promise<any>((resolve, reject) => {
10
- const { destroy, instance } = renderComponent(
11
- component,
12
- {
13
- ...props,
14
- onClosed: () => destroy(),
15
- },
16
- appContext ??
17
- (component as any)._context ??
18
- (window as any).app?._context ??
19
- (window as any)._app?._context,
20
- )
21
-
22
- ;(instance.exposed as any).show(props).then(resolve).catch(reject)
23
- })
24
- }
@@ -1,10 +0,0 @@
1
- import type { App, Plugin } from 'vue'
2
-
3
- export type WithInstall<T> = T & Plugin
4
-
5
- export const withInstall = <T>(main: any): WithInstall<T> => {
6
- ;(main as WithInstall<T>).install = (app: App): void => {
7
- app.component(main.name, main)
8
- }
9
- return main
10
- }
@@ -1,55 +0,0 @@
1
- # VroAspectRatio
2
-
3
- ### 介绍
4
-
5
- 按照指定宽高比撑开容器,常用于图片、视频、卡片封面等固定比例区域。
6
-
7
- ## 代码演示
8
-
9
- ### 基础用法
10
-
11
- ```html
12
- <vro-aspect-ratio :ratio="16 / 9">
13
- <div>16:9</div>
14
- </vro-aspect-ratio>
15
- ```
16
-
17
- ## API
18
-
19
- ### 属性 Props
20
-
21
- <table>
22
- <tbody>
23
- <tr>
24
- <td>名称</td>
25
- <td>类型</td>
26
- <td>默认值</td>
27
- </tr>
28
- <tr v-for="(item, key) in vroAspectRatioProps" :key="key">
29
- <td>{{ key }}</td>
30
- <td>{{ parseType(item.type || item) }}</td>
31
- <td>{{ reserve(item.default, '-') }}</td>
32
- </tr>
33
- </tbody>
34
- </table>
35
-
36
- ### 插槽 Slots
37
-
38
- <table>
39
- <tbody>
40
- <tr>
41
- <td>名称</td>
42
- <td>说明</td>
43
- </tr>
44
- <tr>
45
- <td>default</td>
46
- <td>内容</td>
47
- </tr>
48
- </tbody>
49
- </table>
50
-
51
- <script setup lang="ts">
52
- import { reserve } from '@daysnap/utils'
53
- import { VroAspectRatio, vroAspectRatioProps } from '.'
54
- import { parseType } from '../utils'
55
- </script>
@@ -1,15 +0,0 @@
1
- import { withInstall } from '../utils'
2
- import Component from './vro-aspect-ratio.vue'
3
-
4
- export * from './types'
5
-
6
- export const VroAspectRatio = withInstall<typeof Component>(Component)
7
- export default VroAspectRatio
8
-
9
- export type VroAspectRatioInstance = InstanceType<typeof VroAspectRatio>
10
-
11
- declare module 'vue' {
12
- export interface GlobalComponents {
13
- VroAspectRatio: typeof VroAspectRatio
14
- }
15
- }
@@ -1,2 +0,0 @@
1
- import '../../style/base.scss'
2
- import './index.scss'
@@ -1,16 +0,0 @@
1
- .vro-aspect-ratio {
2
- position: relative;
3
- }
4
-
5
- .vro-aspect-ratio-inner {
6
- position: relative;
7
- width: 100%;
8
- }
9
-
10
- .vro-aspect-ratio-content {
11
- position: absolute;
12
- top: 0;
13
- left: 0;
14
- width: 100%;
15
- height: 100%;
16
- }
@@ -1 +0,0 @@
1
- import './css'
@@ -1,15 +0,0 @@
1
- import type { ExtractPropTypes } from 'vue'
2
-
3
- export const vroAspectRatioProps = {
4
- /**
5
- * 宽高比,等价于 width / height
6
- *
7
- * @default 1
8
- */
9
- ratio: {
10
- type: Number,
11
- default: 1,
12
- },
13
- }
14
-
15
- export type VroAspectRatioProps = ExtractPropTypes<typeof vroAspectRatioProps>
@@ -1,23 +0,0 @@
1
- <template>
2
- <div class="vro-aspect-ratio">
3
- <div class="vro-aspect-ratio-inner" :style="innerStyle">
4
- <div class="vro-aspect-ratio-content">
5
- <slot></slot>
6
- </div>
7
- </div>
8
- </div>
9
- </template>
10
-
11
- <script setup lang="ts">
12
- import { computed } from 'vue'
13
-
14
- import { vroAspectRatioProps } from './types'
15
-
16
- defineOptions({ name: 'VroAspectRatio' })
17
-
18
- const props = defineProps(vroAspectRatioProps)
19
-
20
- const innerStyle = computed(() => ({
21
- paddingTop: `${100 / props.ratio}%`,
22
- }))
23
- </script>
@@ -1,95 +0,0 @@
1
- # VroInput
2
-
3
- ### 介绍
4
-
5
- 对原生 input 的轻量封装,只处理输入值的格式限制,不包含任何样式。ref、原生事件监听和其他原生属性由使用方按普通 input 方式处理。
6
-
7
- ## 代码演示
8
-
9
- ### 基础用法
10
-
11
- ```html
12
- <vro-input v-model="value" placeholder="请输入内容" />
13
- ```
14
-
15
- ### 数字输入
16
-
17
- ```html
18
- <vro-input v-model="value" type="number" />
19
- ```
20
-
21
- ### 小数输入
22
-
23
- `type="decimal"` 会将输入限制为小数,并根据 `precision`、`min`、`max`、`auto-fix` 处理边界。
24
-
25
- ```html
26
- <vro-input v-model="value" type="decimal" :precision="2" :min="0" :max="9999" auto-fix />
27
- ```
28
-
29
- ### 自定义格式化
30
-
31
- ```html
32
- <vro-input v-model="value" :formatter="formatter" />
33
- ```
34
-
35
- ### 获取 input 元素
36
-
37
- ```html
38
- <template>
39
- <vro-input ref="inputRef" v-model="value" />
40
- </template>
41
-
42
- <script setup lang="ts">
43
- import { ref } from 'vue'
44
- import type { VroInputInstance } from '@vrojs/base'
45
-
46
- const value = ref('')
47
- const inputRef = ref<VroInputInstance>()
48
-
49
- inputRef.value?.input?.focus()
50
- </script>
51
- ```
52
-
53
- ## API
54
-
55
- ### 属性 Props
56
-
57
- <table>
58
- <tbody>
59
- <tr>
60
- <td>名称</td>
61
- <td>类型</td>
62
- <td>默认值</td>
63
- </tr>
64
- <tr v-for="(item, key) in vroInputProps" :key="key">
65
- <td>{{ key }}</td>
66
- <td>{{ parseType(item.type || item) }}</td>
67
- <td>{{ reserve(item.default, '-') }}</td>
68
- </tr>
69
- </tbody>
70
- </table>
71
-
72
- ### 事件 Events
73
-
74
- 其他同 input 原生事件
75
-
76
- <table>
77
- <tbody>
78
- <tr>
79
- <td>名称</td>
80
- <td>参数</td>
81
- <td>说明</td>
82
- </tr>
83
- <tr>
84
- <td>update:modelValue</td>
85
- <td>value: string</td>
86
- <td>输入值处理后触发</td>
87
- </tr>
88
- </tbody>
89
- </table>
90
-
91
- <script setup lang="ts">
92
- import { reserve } from '@daysnap/utils'
93
- import { VroInput, vroInputProps } from '.'
94
- import { parseType } from '../utils'
95
- </script>
@@ -1,15 +0,0 @@
1
- import { withInstall } from '../utils'
2
- import Component from './vro-input.vue'
3
-
4
- export * from './types'
5
-
6
- export const VroInput = withInstall<typeof Component>(Component)
7
- export default VroInput
8
-
9
- export type VroInputInstance = InstanceType<typeof VroInput>
10
-
11
- declare module 'vue' {
12
- export interface GlobalComponents {
13
- VroInput: typeof VroInput
14
- }
15
- }
@@ -1,2 +0,0 @@
1
- import '../../style/base.scss'
2
- import './index.scss'
@@ -1 +0,0 @@
1
- import './css'