@scx-js/scx-ui 0.0.1 → 0.0.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/index.js +44 -44
- package/package.json +29 -29
- package/scx-context-menu/index.css +50 -50
- package/scx-context-menu/index.js +65 -65
- package/scx-context-menu/index.vue +86 -86
- package/scx-drag/index.js +30 -30
- package/scx-group/index.css +65 -65
- package/scx-group/index.vue +154 -154
- package/scx-icon/index.css +3 -3
- package/scx-icon/index.vue +20 -20
- package/scx-input/index.css +39 -39
- package/scx-input/index.vue +44 -44
- package/scx-panel/index.css +47 -47
- package/scx-panel/index.vue +28 -28
- package/scx-panel/scx-panel-item.css +36 -36
- package/scx-panel/scx-panel-item.vue +22 -22
- package/scx-progress/index.css +33 -33
- package/scx-progress/index.vue +29 -29
- package/scx-switch/index.css +109 -109
- package/scx-switch/index.vue +31 -31
- package/scx-upload/helper.js +177 -177
- package/scx-upload/index.css +204 -204
- package/scx-upload/index.vue +235 -235
- package/scx-upload-list/index.css +89 -89
- package/scx-upload-list/index.vue +228 -228
- package/style/changeTheme.js +13 -13
- package/style/dark.css +59 -59
- package/style/default.css +98 -98
- package/style/normalize.css +35 -35
package/scx-group/index.css
CHANGED
@@ -1,66 +1,66 @@
|
|
1
|
-
.scx-group {
|
2
|
-
position: relative;
|
3
|
-
width: 100%;
|
4
|
-
box-sizing: border-box;
|
5
|
-
padding: 10px;
|
6
|
-
/* 特有 css */
|
7
|
-
display: flex;
|
8
|
-
flex-direction: column;
|
9
|
-
row-gap: 10px;
|
10
|
-
align-items: center;
|
11
|
-
}
|
12
|
-
|
13
|
-
.scx-group-item {
|
14
|
-
position: relative;
|
15
|
-
width: 100%;
|
16
|
-
box-sizing: border-box;
|
17
|
-
padding: 10px;
|
18
|
-
/* 特有 css */
|
19
|
-
border: 1px dashed var(--scx-text-placeholder-color);
|
20
|
-
background-color: var(--scx-theme-bg);
|
21
|
-
transition: transform 600ms ease, opacity 600ms ease;
|
22
|
-
}
|
23
|
-
|
24
|
-
.scx-group-item-operation {
|
25
|
-
position: absolute;
|
26
|
-
top: 0;
|
27
|
-
right: 0;
|
28
|
-
display: flex;
|
29
|
-
}
|
30
|
-
|
31
|
-
.scx-group-item-move-up-button {
|
32
|
-
/* 占位用 方便开发者覆盖 css */
|
33
|
-
}
|
34
|
-
|
35
|
-
.scx-group-item-move-down-button {
|
36
|
-
/* 占位用 方便开发者覆盖 css */
|
37
|
-
}
|
38
|
-
|
39
|
-
.scx-group-item-remove-button {
|
40
|
-
/* 占位用 方便开发者覆盖 css */
|
41
|
-
}
|
42
|
-
|
43
|
-
/*简单设置一下 默认占位按钮的样式*/
|
44
|
-
.scx-group-item-operation .placeholder-button {
|
45
|
-
display: flex;
|
46
|
-
height: 22px;
|
47
|
-
width: 22px;
|
48
|
-
justify-content: center;
|
49
|
-
align-items: center;
|
50
|
-
}
|
51
|
-
|
52
|
-
/*以下为 vue 动画*/
|
53
|
-
.scx-group-list-enter-from {
|
54
|
-
opacity: 0;
|
55
|
-
transform: scale(0.98);
|
56
|
-
}
|
57
|
-
|
58
|
-
.scx-group-list-leave-to {
|
59
|
-
opacity: 0;
|
60
|
-
transform: scale(0.98);
|
61
|
-
}
|
62
|
-
|
63
|
-
/* 重要 !!!!! 避免嵌套动画延迟 */
|
64
|
-
.scx-group-list-move .scx-group-list-move {
|
65
|
-
transition: unset;
|
1
|
+
.scx-group {
|
2
|
+
position: relative;
|
3
|
+
width: 100%;
|
4
|
+
box-sizing: border-box;
|
5
|
+
padding: 10px;
|
6
|
+
/* 特有 css */
|
7
|
+
display: flex;
|
8
|
+
flex-direction: column;
|
9
|
+
row-gap: 10px;
|
10
|
+
align-items: center;
|
11
|
+
}
|
12
|
+
|
13
|
+
.scx-group-item {
|
14
|
+
position: relative;
|
15
|
+
width: 100%;
|
16
|
+
box-sizing: border-box;
|
17
|
+
padding: 10px;
|
18
|
+
/* 特有 css */
|
19
|
+
border: 1px dashed var(--scx-text-placeholder-color);
|
20
|
+
background-color: var(--scx-theme-bg);
|
21
|
+
transition: transform 600ms ease, opacity 600ms ease;
|
22
|
+
}
|
23
|
+
|
24
|
+
.scx-group-item-operation {
|
25
|
+
position: absolute;
|
26
|
+
top: 0;
|
27
|
+
right: 0;
|
28
|
+
display: flex;
|
29
|
+
}
|
30
|
+
|
31
|
+
.scx-group-item-move-up-button {
|
32
|
+
/* 占位用 方便开发者覆盖 css */
|
33
|
+
}
|
34
|
+
|
35
|
+
.scx-group-item-move-down-button {
|
36
|
+
/* 占位用 方便开发者覆盖 css */
|
37
|
+
}
|
38
|
+
|
39
|
+
.scx-group-item-remove-button {
|
40
|
+
/* 占位用 方便开发者覆盖 css */
|
41
|
+
}
|
42
|
+
|
43
|
+
/*简单设置一下 默认占位按钮的样式*/
|
44
|
+
.scx-group-item-operation .placeholder-button {
|
45
|
+
display: flex;
|
46
|
+
height: 22px;
|
47
|
+
width: 22px;
|
48
|
+
justify-content: center;
|
49
|
+
align-items: center;
|
50
|
+
}
|
51
|
+
|
52
|
+
/*以下为 vue 动画*/
|
53
|
+
.scx-group-list-enter-from {
|
54
|
+
opacity: 0;
|
55
|
+
transform: scale(0.98);
|
56
|
+
}
|
57
|
+
|
58
|
+
.scx-group-list-leave-to {
|
59
|
+
opacity: 0;
|
60
|
+
transform: scale(0.98);
|
61
|
+
}
|
62
|
+
|
63
|
+
/* 重要 !!!!! 避免嵌套动画延迟 */
|
64
|
+
.scx-group-list-move .scx-group-list-move {
|
65
|
+
transition: unset;
|
66
66
|
}
|
package/scx-group/index.vue
CHANGED
@@ -1,154 +1,154 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="scx-group">
|
3
|
-
<slot name="before"></slot>
|
4
|
-
<transition-group name="scx-group-list" @before-leave="fixedElement">
|
5
|
-
<div v-for="(item,i) in list" :key="item" class="scx-group-item">
|
6
|
-
<slot :index="i" :item="item"></slot>
|
7
|
-
<div class="scx-group-item-operation">
|
8
|
-
<slot :index="i" :item="item" name="itemOperation"></slot>
|
9
|
-
<div v-if="showMoveUp(i)" class="scx-group-item-move-up-button" @click="groupItemMoveUp(i)">
|
10
|
-
<slot name="moveUpButton">
|
11
|
-
<button class="placeholder-button" type="button">↑</button>
|
12
|
-
</slot>
|
13
|
-
</div>
|
14
|
-
<div v-if="showMoveDown(i)" class="scx-group-item-move-down-button" @click="groupItemMoveDown(i)">
|
15
|
-
<slot name="moveDownButton">
|
16
|
-
<button class="placeholder-button" type="button">↓</button>
|
17
|
-
</slot>
|
18
|
-
</div>
|
19
|
-
<div v-if="showRemoveButton" class="scx-group-item-remove-button" @click="groupItemRemove(i)">
|
20
|
-
<slot name="removeButton">
|
21
|
-
<button class="placeholder-button" type="button">X</button>
|
22
|
-
</slot>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
</transition-group>
|
27
|
-
<slot name="after"></slot>
|
28
|
-
</div>
|
29
|
-
</template>
|
30
|
-
|
31
|
-
<script>
|
32
|
-
import "./index.css";
|
33
|
-
import {computed} from "vue";
|
34
|
-
import {fixedElement, moveDownByIndex, moveUpByIndex, removeByIndex} from "../../scx-common/index.js";
|
35
|
-
|
36
|
-
export default {
|
37
|
-
name: "scx-group",
|
38
|
-
props: {
|
39
|
-
modelValue: {
|
40
|
-
type: Array,
|
41
|
-
required: true,
|
42
|
-
default: [],
|
43
|
-
},
|
44
|
-
beforeRemove: {
|
45
|
-
type: Function,
|
46
|
-
default: null
|
47
|
-
},
|
48
|
-
beforeMoveUp: {
|
49
|
-
type: Function,
|
50
|
-
default: null
|
51
|
-
},
|
52
|
-
beforeMoveDown: {
|
53
|
-
type: Function,
|
54
|
-
default: null
|
55
|
-
},
|
56
|
-
loop: {
|
57
|
-
type: Boolean,
|
58
|
-
default: true
|
59
|
-
},
|
60
|
-
showRemoveButton: {
|
61
|
-
type: Boolean,
|
62
|
-
default: true
|
63
|
-
},
|
64
|
-
showMoveButton: {
|
65
|
-
type: Boolean,
|
66
|
-
default: true
|
67
|
-
}
|
68
|
-
},
|
69
|
-
setup(props, ctx) {
|
70
|
-
|
71
|
-
if (!props.modelValue) {
|
72
|
-
ctx.emit("update:modelValue", []);
|
73
|
-
}
|
74
|
-
|
75
|
-
const list = computed({
|
76
|
-
get() {
|
77
|
-
return props.modelValue;
|
78
|
-
},
|
79
|
-
set(value) {
|
80
|
-
ctx.emit("update:modelValue", value);
|
81
|
-
}
|
82
|
-
});
|
83
|
-
|
84
|
-
async function groupItemRemove(index) {
|
85
|
-
if (props.beforeRemove) {
|
86
|
-
//如果返回值是 false 则不添加
|
87
|
-
const result = await props.beforeRemove(list.value[index]);
|
88
|
-
if (!result) {
|
89
|
-
return;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
removeByIndex(list.value, index);
|
93
|
-
}
|
94
|
-
|
95
|
-
async function groupItemMoveUp(index) {
|
96
|
-
if (props.beforeMoveUp) {
|
97
|
-
//如果返回值是 false 则不添加
|
98
|
-
const result = await props.beforeMoveUp(index);
|
99
|
-
if (!result) {
|
100
|
-
return;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
moveUpByIndex(list.value, index, props.loop);
|
104
|
-
}
|
105
|
-
|
106
|
-
async function groupItemMoveDown(index) {
|
107
|
-
if (props.beforeMoveDown) {
|
108
|
-
//如果返回值是 false 则不添加
|
109
|
-
const result = await props.beforeMoveDown(index);
|
110
|
-
if (!result) {
|
111
|
-
return;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
moveDownByIndex(list.value, index, props.loop);
|
115
|
-
}
|
116
|
-
|
117
|
-
function showMoveUp(i) {
|
118
|
-
if (!props.showMoveButton) {
|
119
|
-
return false;
|
120
|
-
}
|
121
|
-
const minIndex = 0;
|
122
|
-
//数据量小的时候没必要显示
|
123
|
-
if (list.value.length <= 2 && i === minIndex) {
|
124
|
-
return false;
|
125
|
-
} else {//数据量大的时候 如果没启用循环 第一项不显示
|
126
|
-
return props.loop ? true : i !== minIndex;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
function showMoveDown(i) {
|
131
|
-
if (!props.showMoveButton) {
|
132
|
-
return false;
|
133
|
-
}
|
134
|
-
const maxIndex = list.value.length - 1;
|
135
|
-
//数据量小的时候没必要显示
|
136
|
-
if (list.value.length <= 2 && i === maxIndex) {
|
137
|
-
return false;
|
138
|
-
} else { //数据量大的时候 如果没启用循环 最后一项不显示
|
139
|
-
return props.loop ? true : i !== maxIndex;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
return {
|
144
|
-
list,
|
145
|
-
groupItemRemove,
|
146
|
-
fixedElement,
|
147
|
-
groupItemMoveUp,
|
148
|
-
groupItemMoveDown,
|
149
|
-
showMoveUp,
|
150
|
-
showMoveDown
|
151
|
-
};
|
152
|
-
}
|
153
|
-
};
|
154
|
-
</script>
|
1
|
+
<template>
|
2
|
+
<div class="scx-group">
|
3
|
+
<slot name="before"></slot>
|
4
|
+
<transition-group name="scx-group-list" @before-leave="fixedElement">
|
5
|
+
<div v-for="(item,i) in list" :key="item" class="scx-group-item">
|
6
|
+
<slot :index="i" :item="item"></slot>
|
7
|
+
<div class="scx-group-item-operation">
|
8
|
+
<slot :index="i" :item="item" name="itemOperation"></slot>
|
9
|
+
<div v-if="showMoveUp(i)" class="scx-group-item-move-up-button" @click="groupItemMoveUp(i)">
|
10
|
+
<slot name="moveUpButton">
|
11
|
+
<button class="placeholder-button" type="button">↑</button>
|
12
|
+
</slot>
|
13
|
+
</div>
|
14
|
+
<div v-if="showMoveDown(i)" class="scx-group-item-move-down-button" @click="groupItemMoveDown(i)">
|
15
|
+
<slot name="moveDownButton">
|
16
|
+
<button class="placeholder-button" type="button">↓</button>
|
17
|
+
</slot>
|
18
|
+
</div>
|
19
|
+
<div v-if="showRemoveButton" class="scx-group-item-remove-button" @click="groupItemRemove(i)">
|
20
|
+
<slot name="removeButton">
|
21
|
+
<button class="placeholder-button" type="button">X</button>
|
22
|
+
</slot>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</transition-group>
|
27
|
+
<slot name="after"></slot>
|
28
|
+
</div>
|
29
|
+
</template>
|
30
|
+
|
31
|
+
<script>
|
32
|
+
import "./index.css";
|
33
|
+
import {computed} from "vue";
|
34
|
+
import {fixedElement, moveDownByIndex, moveUpByIndex, removeByIndex} from "../../scx-common/index.js";
|
35
|
+
|
36
|
+
export default {
|
37
|
+
name: "scx-group",
|
38
|
+
props: {
|
39
|
+
modelValue: {
|
40
|
+
type: Array,
|
41
|
+
required: true,
|
42
|
+
default: [],
|
43
|
+
},
|
44
|
+
beforeRemove: {
|
45
|
+
type: Function,
|
46
|
+
default: null
|
47
|
+
},
|
48
|
+
beforeMoveUp: {
|
49
|
+
type: Function,
|
50
|
+
default: null
|
51
|
+
},
|
52
|
+
beforeMoveDown: {
|
53
|
+
type: Function,
|
54
|
+
default: null
|
55
|
+
},
|
56
|
+
loop: {
|
57
|
+
type: Boolean,
|
58
|
+
default: true
|
59
|
+
},
|
60
|
+
showRemoveButton: {
|
61
|
+
type: Boolean,
|
62
|
+
default: true
|
63
|
+
},
|
64
|
+
showMoveButton: {
|
65
|
+
type: Boolean,
|
66
|
+
default: true
|
67
|
+
}
|
68
|
+
},
|
69
|
+
setup(props, ctx) {
|
70
|
+
|
71
|
+
if (!props.modelValue) {
|
72
|
+
ctx.emit("update:modelValue", []);
|
73
|
+
}
|
74
|
+
|
75
|
+
const list = computed({
|
76
|
+
get() {
|
77
|
+
return props.modelValue;
|
78
|
+
},
|
79
|
+
set(value) {
|
80
|
+
ctx.emit("update:modelValue", value);
|
81
|
+
}
|
82
|
+
});
|
83
|
+
|
84
|
+
async function groupItemRemove(index) {
|
85
|
+
if (props.beforeRemove) {
|
86
|
+
//如果返回值是 false 则不添加
|
87
|
+
const result = await props.beforeRemove(list.value[index]);
|
88
|
+
if (!result) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
removeByIndex(list.value, index);
|
93
|
+
}
|
94
|
+
|
95
|
+
async function groupItemMoveUp(index) {
|
96
|
+
if (props.beforeMoveUp) {
|
97
|
+
//如果返回值是 false 则不添加
|
98
|
+
const result = await props.beforeMoveUp(index);
|
99
|
+
if (!result) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
moveUpByIndex(list.value, index, props.loop);
|
104
|
+
}
|
105
|
+
|
106
|
+
async function groupItemMoveDown(index) {
|
107
|
+
if (props.beforeMoveDown) {
|
108
|
+
//如果返回值是 false 则不添加
|
109
|
+
const result = await props.beforeMoveDown(index);
|
110
|
+
if (!result) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
moveDownByIndex(list.value, index, props.loop);
|
115
|
+
}
|
116
|
+
|
117
|
+
function showMoveUp(i) {
|
118
|
+
if (!props.showMoveButton) {
|
119
|
+
return false;
|
120
|
+
}
|
121
|
+
const minIndex = 0;
|
122
|
+
//数据量小的时候没必要显示
|
123
|
+
if (list.value.length <= 2 && i === minIndex) {
|
124
|
+
return false;
|
125
|
+
} else {//数据量大的时候 如果没启用循环 第一项不显示
|
126
|
+
return props.loop ? true : i !== minIndex;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
function showMoveDown(i) {
|
131
|
+
if (!props.showMoveButton) {
|
132
|
+
return false;
|
133
|
+
}
|
134
|
+
const maxIndex = list.value.length - 1;
|
135
|
+
//数据量小的时候没必要显示
|
136
|
+
if (list.value.length <= 2 && i === maxIndex) {
|
137
|
+
return false;
|
138
|
+
} else { //数据量大的时候 如果没启用循环 最后一项不显示
|
139
|
+
return props.loop ? true : i !== maxIndex;
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
return {
|
144
|
+
list,
|
145
|
+
groupItemRemove,
|
146
|
+
fixedElement,
|
147
|
+
groupItemMoveUp,
|
148
|
+
groupItemMoveDown,
|
149
|
+
showMoveUp,
|
150
|
+
showMoveDown
|
151
|
+
};
|
152
|
+
}
|
153
|
+
};
|
154
|
+
</script>
|
package/scx-icon/index.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
.scx-icon {
|
2
|
-
width: 1em;
|
3
|
-
height: 1em;
|
1
|
+
.scx-icon {
|
2
|
+
width: 1em;
|
3
|
+
height: 1em;
|
4
4
|
}
|
package/scx-icon/index.vue
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
<template>
|
2
|
-
<svg class="scx-icon">
|
3
|
-
<use :href="'#scx-icon_' + icon"></use>
|
4
|
-
</svg>
|
5
|
-
</template>
|
6
|
-
|
7
|
-
<script>
|
8
|
-
import "./index.css";
|
9
|
-
|
10
|
-
export default {
|
11
|
-
name: "scx-icon",
|
12
|
-
props: {
|
13
|
-
icon: {
|
14
|
-
type: String,
|
15
|
-
default: "",
|
16
|
-
required: true
|
17
|
-
}
|
18
|
-
}
|
19
|
-
};
|
20
|
-
</script>
|
1
|
+
<template>
|
2
|
+
<svg class="scx-icon">
|
3
|
+
<use :href="'#scx-icon_' + icon"></use>
|
4
|
+
</svg>
|
5
|
+
</template>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
import "./index.css";
|
9
|
+
|
10
|
+
export default {
|
11
|
+
name: "scx-icon",
|
12
|
+
props: {
|
13
|
+
icon: {
|
14
|
+
type: String,
|
15
|
+
default: "",
|
16
|
+
required: true
|
17
|
+
}
|
18
|
+
}
|
19
|
+
};
|
20
|
+
</script>
|
package/scx-input/index.css
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
.scx-input {
|
2
|
-
display: flex;
|
3
|
-
justify-content: space-between;
|
4
|
-
align-self: center;
|
5
|
-
align-items: center;
|
6
|
-
/* 32px 是当前这个元素的高度 默认被内部的 input 撑起来的高度*/
|
7
|
-
border-radius: calc(32px / 2);
|
8
|
-
background: var(--scx-input_bg);
|
9
|
-
box-shadow: var(--scx-input_box-shadow);
|
10
|
-
transition: all 100ms cubic-bezier(0.23, 1, 0.32, 1);
|
11
|
-
padding-left: 10px;
|
12
|
-
padding-right: 10px;
|
13
|
-
box-sizing: border-box;
|
14
|
-
}
|
15
|
-
|
16
|
-
.scx-input > input {
|
17
|
-
width: 100%;
|
18
|
-
outline: none;
|
19
|
-
font-size: 15px;
|
20
|
-
height: 30px;
|
21
|
-
border: 0;
|
22
|
-
background-color: transparent;
|
23
|
-
margin-left: 10px;
|
24
|
-
margin-right: 10px;
|
25
|
-
}
|
26
|
-
|
27
|
-
.scx-input > input::placeholder {
|
28
|
-
color: var(--scx-text-placeholder-color);
|
29
|
-
}
|
30
|
-
|
31
|
-
.scx-input > svg {
|
32
|
-
width: 20px;
|
33
|
-
flex-shrink: 0;
|
34
|
-
cursor: pointer;
|
35
|
-
}
|
36
|
-
|
37
|
-
.scx-input:focus-within {
|
38
|
-
box-shadow: var(--scx-input-hover_box-shadow);
|
39
|
-
}
|
1
|
+
.scx-input {
|
2
|
+
display: flex;
|
3
|
+
justify-content: space-between;
|
4
|
+
align-self: center;
|
5
|
+
align-items: center;
|
6
|
+
/* 32px 是当前这个元素的高度 默认被内部的 input 撑起来的高度*/
|
7
|
+
border-radius: calc(32px / 2);
|
8
|
+
background: var(--scx-input_bg);
|
9
|
+
box-shadow: var(--scx-input_box-shadow);
|
10
|
+
transition: all 100ms cubic-bezier(0.23, 1, 0.32, 1);
|
11
|
+
padding-left: 10px;
|
12
|
+
padding-right: 10px;
|
13
|
+
box-sizing: border-box;
|
14
|
+
}
|
15
|
+
|
16
|
+
.scx-input > input {
|
17
|
+
width: 100%;
|
18
|
+
outline: none;
|
19
|
+
font-size: 15px;
|
20
|
+
height: 30px;
|
21
|
+
border: 0;
|
22
|
+
background-color: transparent;
|
23
|
+
margin-left: 10px;
|
24
|
+
margin-right: 10px;
|
25
|
+
}
|
26
|
+
|
27
|
+
.scx-input > input::placeholder {
|
28
|
+
color: var(--scx-text-placeholder-color);
|
29
|
+
}
|
30
|
+
|
31
|
+
.scx-input > svg {
|
32
|
+
width: 20px;
|
33
|
+
flex-shrink: 0;
|
34
|
+
cursor: pointer;
|
35
|
+
}
|
36
|
+
|
37
|
+
.scx-input:focus-within {
|
38
|
+
box-shadow: var(--scx-input-hover_box-shadow);
|
39
|
+
}
|
package/scx-input/index.vue
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="scx-input">
|
3
|
-
<scx-icon v-if="icon" :icon="icon"/>
|
4
|
-
<input v-model="m" :placeholder="placeholder" type="text"/>
|
5
|
-
<scx-icon v-show="m!==''" icon="outlined-close" @click="m=''"/>
|
6
|
-
</div>
|
7
|
-
</template>
|
8
|
-
|
9
|
-
<script>
|
10
|
-
import "./index.css";
|
11
|
-
import {computed} from "vue";
|
12
|
-
|
13
|
-
export default {
|
14
|
-
name: "scx-input",
|
15
|
-
props: {
|
16
|
-
modelValue: {
|
17
|
-
type: String,
|
18
|
-
required: true,
|
19
|
-
default: "",
|
20
|
-
},
|
21
|
-
placeholder: {
|
22
|
-
type: String,
|
23
|
-
default: "输入名称搜索",
|
24
|
-
},
|
25
|
-
icon: {
|
26
|
-
type: String,
|
27
|
-
default: null
|
28
|
-
}
|
29
|
-
},
|
30
|
-
setup(props, context) {
|
31
|
-
|
32
|
-
const m = computed({
|
33
|
-
get() {
|
34
|
-
return props.modelValue;
|
35
|
-
},
|
36
|
-
set(value) {
|
37
|
-
context.emit("update:modelValue", value);
|
38
|
-
}
|
39
|
-
});
|
40
|
-
|
41
|
-
return {m};
|
42
|
-
}
|
43
|
-
};
|
44
|
-
</script>
|
1
|
+
<template>
|
2
|
+
<div class="scx-input">
|
3
|
+
<scx-icon v-if="icon" :icon="icon"/>
|
4
|
+
<input v-model="m" :placeholder="placeholder" type="text"/>
|
5
|
+
<scx-icon v-show="m!==''" icon="outlined-close" @click="m=''"/>
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
|
9
|
+
<script>
|
10
|
+
import "./index.css";
|
11
|
+
import {computed} from "vue";
|
12
|
+
|
13
|
+
export default {
|
14
|
+
name: "scx-input",
|
15
|
+
props: {
|
16
|
+
modelValue: {
|
17
|
+
type: String,
|
18
|
+
required: true,
|
19
|
+
default: "",
|
20
|
+
},
|
21
|
+
placeholder: {
|
22
|
+
type: String,
|
23
|
+
default: "输入名称搜索",
|
24
|
+
},
|
25
|
+
icon: {
|
26
|
+
type: String,
|
27
|
+
default: null
|
28
|
+
}
|
29
|
+
},
|
30
|
+
setup(props, context) {
|
31
|
+
|
32
|
+
const m = computed({
|
33
|
+
get() {
|
34
|
+
return props.modelValue;
|
35
|
+
},
|
36
|
+
set(value) {
|
37
|
+
context.emit("update:modelValue", value);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
return {m};
|
42
|
+
}
|
43
|
+
};
|
44
|
+
</script>
|