Commit 73b6c854 authored by shj's avatar shj

[ADD] 인덱스 입력값 유효성 검사 추가

parent 4bd45319
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-icon size="16" @click="formData = null, editFormMethod = ''">mdi-close</v-icon> <v-icon size="16" @click="formData = null, editFormMethod = ''">mdi-close</v-icon>
</v-subheader> </v-subheader>
<v-form> <v-form v-model="isValidFormData">
<v-container class="pt-6 text-center"> <v-container class="pt-6 text-center">
<v-select <v-select
:items="['ko','en']" :items="['ko','en']"
...@@ -213,30 +213,34 @@ ...@@ -213,30 +213,34 @@
<v-text-field <v-text-field
v-model="formData.order" v-model="formData.order"
label="Order" label="Order"
:rules="rules.order"
min="0"
type="number" type="number"
/> />
<v-text-field <v-text-field
v-model="formData.path" v-model="formData.path"
label="Path (ex: 'propect/dashboard/')" label="Path (ex: 'propect/dashboard/')"
@input="setDepthValue" @input="setDepthValue"
:rules="rules.path"
type="text" type="text"
/> />
<v-text-field <v-text-field
v-model="formData.depth" v-model="formData.depth"
:disabled="editFormMethod !== '수정'" disabled
label="Depth" label="Depth"
type="number" type="number"
/> />
<v-btn <v-btn
@click="editFormMethod === '추가' ? createIndex() : updateIndex()" @click="editFormMethod === '추가' ? createIndex() : updateIndex()"
:disabled="!isValidFormData"
elevation="0" elevation="0"
color="primary" color="primary"
>저장</v-btn> >저장</v-btn>
<v-btn <v-btn
@click="removeIndex" @click="removeIndex"
:disabled="editFormMethod !== '수정'"
elevation="0" elevation="0"
color="primary" color="primary"
:disabled="editFormMethod !== '수정'"
>삭제</v-btn> >삭제</v-btn>
</v-container> </v-container>
</v-form> </v-form>
...@@ -293,6 +297,18 @@ export default{ ...@@ -293,6 +297,18 @@ export default{
editModeRemainList: [], editModeRemainList: [],
editFormMethod: '', editFormMethod: '',
formData: null, formData: null,
isValidFormData: null,
rules: {
order: [
v => /^[0-9]+$/.test(v) || '숫자만 입력 가능합니다.',
],
path: [
v => v[0] !== '/' || '슬래시(/)로 시작할 수 없습니다.',
v => v.indexOf('//') === -1 || '슬래시(/)를 연속으로 사용할 수 없습니다.',
v => /^[a-zA-Z0-9\_\/]+$/.test(v) || '영문,숫자,언더바(_),슬래시(/)만 입력 가능합니다.',
v => v[v.length-1] === '/' || '마지막 문자는 슬래시(/)로 작성해주세요.',
]
},
}), }),
computed: { computed: {
searchedList() { searchedList() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment