Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit 515051e

Browse files
✨ CSV input
1 parent b170b30 commit 515051e

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

components/form/CommaList.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,35 @@ export default class CommaList extends Vue {
6767
@Prop() autocomplete;
6868
labelId = "";
6969
list = [""];
70-
71-
get commaList() {
72-
return this.list.filter(item => !!item).join(",");
73-
}
70+
commaList = "";
7471
7572
private created() {
7673
this.labelId = Math.random()
7774
.toString(36)
7875
.substring(7);
7976
}
8077
78+
private mounted() {
79+
if (this.value) this.list = this.value.split(",");
80+
}
81+
8182
private add() {
8283
this.list.push("");
84+
this.update();
8385
}
8486
8587
private remove(index) {
8688
this.list.splice(index, 1);
89+
this.update();
8790
}
8891
8992
private input(index, val) {
9093
this.list[index] = val.target.value;
94+
this.update();
95+
}
96+
97+
private update() {
98+
this.commaList = this.list.filter(item => !!item).join(",");
9199
this.$emit("input", this.commaList);
92100
}
93101
}

pages/manage/_team/api-keys/_key.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,8 @@
2424
label="IP restrictions"
2525
:value="apiKey.ipRestrictions"
2626
placeholder="Enter an IP address or CIDR, e.g., 192.168.1.1/42"
27-
@input="
28-
val => {
29-
apiKey.ipRestrictions = val;
30-
$forceUpdate();
31-
}
32-
"
27+
@input="val => (apiKey.ipRestrictions = val)"
3328
/>
34-
{{ apiKey.ipRestrictions }}
3529
<CommaList
3630
label="Referrer restrictions"
3731
:value="apiKey.referrerRestrictions"

0 commit comments

Comments
 (0)