@neatui/nuxt 1.6.0 → 1.6.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neatui/nuxt",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "NeatUI component library for Nuxt 3",
5
5
  "main": "./src/index.ts",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "@fekit/scale": "^2.0.1",
37
37
  "@fekit/scrollto": "^3.0.3",
38
38
  "@fekit/toast": "^2.7.2",
39
- "@fekit/utils": "^4.3.1",
39
+ "@fekit/utils": "^5.0.0",
40
40
  "@neatui/css": "^3.15.0",
41
41
  "@rollup/plugin-commonjs": "^26.0.1",
42
42
  "@rollup/plugin-node-resolve": "^15.2.3",
@@ -3,7 +3,7 @@
3
3
  :ui-form="`${theme} sz:${sz} ${state.error.co} type:input ${block ? ' :block' : ''} ${disabled ? 'disabled' : ''} ${readonly ? 'readonly' : ''}`"
4
4
  @click="emits('click', $event)"
5
5
  >
6
- <div :ui-form-tips="state.error.ontips">{{ state.error.tips }}</div>
6
+ <div v-if="state.interacted" :ui-form-tips="state.error.ontips">{{ state.error.tips }}</div>
7
7
  <div ui-form-prefix="">
8
8
  <template v-for="(item, idx) in prefix" :key="idx">
9
9
  <div v-if="isObject(item)" v-bind="item.attrs" v-on="event(item, props.modelValue)">
@@ -66,7 +66,7 @@
66
66
  * readonly 是否只读
67
67
  * clearable 是否显示清除按钮
68
68
  * rules 校验规则
69
- * verify 是否是示校验图标 2=tips 3=text 4=icon 5=tips+text 6=text+icon 7=text+icon
69
+ * verify 是否显示校验
70
70
  * prefix 前缀内容
71
71
  * suffix 后缀内容
72
72
  * interacted 用户是否交互
@@ -92,7 +92,7 @@
92
92
  verify?: boolean;
93
93
  prefix?: Array<any>;
94
94
  suffix?: Array<any>;
95
- interacted?: boolean;
95
+ interacted?: boolean | number | null;
96
96
  }
97
97
  const props: any = withDefaults(defineProps<Props>(), {
98
98
  modelValue: '',
@@ -113,12 +113,12 @@
113
113
  verify: false,
114
114
  prefix: () => [],
115
115
  suffix: () => [],
116
- interacted: false,
116
+ interacted: null,
117
117
  });
118
118
 
119
119
  const state: any = reactive({
120
120
  // 用户是否交互
121
- interacted: false,
121
+ interacted: null,
122
122
  // 值
123
123
  value: props.modelValue,
124
124
  // 错误
@@ -130,7 +130,7 @@
130
130
  (interacted: any) => {
131
131
  state.interacted = interacted;
132
132
  },
133
- { deep: true, immediate: true },
133
+ { immediate: true },
134
134
  );
135
135
 
136
136
  // 校验
@@ -138,6 +138,8 @@
138
138
  [() => state.interacted, () => props.modelValue],
139
139
  async () => {
140
140
  if (state.interacted) {
141
+ const hasValue =
142
+ props.modelValue !== '' && props.modelValue !== null && props.modelValue !== undefined;
141
143
  // 提示文案
142
144
  let tips = '';
143
145
  // 错误类型
@@ -145,7 +147,7 @@
145
147
  // 验证结果
146
148
  let verify = '';
147
149
 
148
- if (props.modelValue) {
150
+ if (hasValue) {
149
151
  // 有值
150
152
  let hasError = false;
151
153
  // 遍历校验规则
@@ -35,47 +35,70 @@
35
35
  </template>
36
36
 
37
37
  <script setup lang="ts">
38
- import { reactive, watch, PropType } from 'vue';
38
+ import { reactive, watch } from 'vue';
39
39
  import { isObject } from '@fekit/utils';
40
40
 
41
41
  const emits = defineEmits(['update:modelValue', 'click', 'blur', 'focus', 'change', 'input', 'clear']);
42
- const props = defineProps({
42
+
43
+ interface Props {
43
44
  // 主题
44
- theme: { type: String, default: '@a' },
45
+ theme?: string;
45
46
  // 尺寸
46
- sz: { type: String, default: '' },
47
+ sz?: string;
47
48
  // 颜色
48
- co: { type: String, default: '' },
49
+ co?: string;
49
50
  // 撑满
50
- block: { type: Boolean, default: true },
51
+ block?: boolean;
51
52
  // 准备就绪
52
- ready: { type: Boolean, default: false },
53
+ ready?: boolean;
53
54
  // 值
54
- modelValue: { type: [String, Number], default: '' },
55
+ modelValue?: string | number;
55
56
  // 类型
56
- type: { type: String, default: 'text' },
57
+ type?: string;
57
58
  // 提示文案
58
- tips: { type: String, default: '' },
59
+ tips?: string;
59
60
  // 内容占位
60
- placeholder: { type: String, default: '' },
61
+ placeholder?: string;
61
62
  // 最大长度
62
- maxlength: { type: Number, default: null },
63
+ maxlength?: number | null;
63
64
  // 最小长度
64
- minlength: { type: Number, default: null },
65
+ minlength?: number | null;
65
66
  // 是否禁用
66
- disabled: { type: Boolean, default: false },
67
+ disabled?: boolean;
67
68
  // 是否只读
68
- readonly: { type: Boolean, default: false },
69
+ readonly?: boolean;
69
70
  // 是否显示清除按钮
70
- clearable: { type: Boolean, default: true },
71
+ clearable?: boolean;
71
72
  // 校验规则
72
- rules: { type: Array as PropType<any[]>, default: () => [] },
73
+ rules?: any[];
73
74
  // 是否是示校验图标
74
- verify: { type: Boolean, default: false },
75
- prefix: { type: Array as PropType<any[]>, default: () => [] },
76
- suffix: { type: Array as PropType<any[]>, default: () => [] },
75
+ verify?: boolean;
76
+ prefix?: any[];
77
+ suffix?: any[];
77
78
  // 用户是否交互
78
- interacted: { type: Boolean, default: false }
79
+ interacted?: boolean;
80
+ }
81
+
82
+ const props = withDefaults(defineProps<Props>(), {
83
+ theme: '@a',
84
+ sz: '',
85
+ co: '',
86
+ block: true,
87
+ ready: false,
88
+ modelValue: '',
89
+ type: 'text',
90
+ tips: '',
91
+ placeholder: '',
92
+ maxlength: null,
93
+ minlength: null,
94
+ disabled: false,
95
+ readonly: false,
96
+ clearable: true,
97
+ rules: () => [],
98
+ verify: false,
99
+ prefix: () => [],
100
+ suffix: () => [],
101
+ interacted: false
79
102
  });
80
103
 
81
104
  const state: any = reactive({
@@ -94,7 +94,7 @@
94
94
  verify?: boolean;
95
95
  prefix?: Array<any>;
96
96
  suffix?: Array<any>;
97
- interacted?: boolean;
97
+ interacted?: boolean | number | null;
98
98
  autoHeight?: boolean;
99
99
  rows?: number;
100
100
  }
@@ -116,7 +116,7 @@
116
116
  verify: false,
117
117
  prefix: () => [],
118
118
  suffix: () => [],
119
- interacted: false,
119
+ interacted: null,
120
120
  // textarea 特有属性默认值
121
121
  autoHeight: false,
122
122
  rows: 3,
@@ -124,7 +124,7 @@
124
124
 
125
125
  const state: any = reactive({
126
126
  // 用户是否交互
127
- interacted: false,
127
+ interacted: null,
128
128
  // 值
129
129
  value: props.modelValue,
130
130
  // 错误
@@ -1,7 +1,7 @@
1
1
  import Input from './Input@v3.vue';
2
2
  import InputRange from './InputRange.vue';
3
3
  import Switch from './Switch.vue';
4
- import Textarea from './Textarea@v2.vue';
4
+ import Textarea from './Textarea.vue';
5
5
 
6
6
  import Checkbox from './Checkbox.vue';
7
7
  import CheckboxItem from './CheckboxItem.vue';