티스토리 뷰
중복 체크 등 함수 호출할 때 예시입니다.
<template>
<v-container>
<v-row>
<v-col cols="12" md="4">
<v-form ref="form">
<v-text-field
v-model="id"
:rules="idRules"
></v-text-field>
</v-form>
</v-col>
</v-row>
</v-container>
</template>
<script>
export default {
data: () => ({
ids: ['aa','bb'],
id: null
}),
computed: {
idRules () {
const rules = []
const rule = v => !!v || 'ID는 필수입니다'
rules.push(rule)
const dupRule = v => this.checkId(v) || '동일한 ID가 존재합니다'
rules.push(dupRule)
return rules
},
},
methods: {
checkId(v) {
for(var i=0;i<this.ids.length;i++){
if(this.ids === v){
return false
}
}
return true
}
}
</script>'Working log' 카테고리의 다른 글
| String.format 예제 (0) | 2021.12.02 |
|---|---|
| [javascript] Array, Set 관련 예제 (0) | 2021.12.01 |
| 20190522001 - vuejs keyup이벤트 문자 짤림 (0) | 2019.05.22 |
| 20190328002 - modal, popover 이벤트 처리 (0) | 2019.03.28 |
| 20190328001 - IE 8 지원 관련 개발 (0) | 2019.03.28 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- listToMap
- cache
- 그리드
- 스프링
- REST
- sample
- Spring Boot
- mapToList
- 타임리프
- example
- 메시지
- ag grid
- thymeleaf
- restful서비스
- 설정
- RESTful
- Javascript
- spring
- UI
- mybatis
- SHEETJS
- 샘플
- AG-GRID
- 예제
- oracle
- 엑셀
- 스프링부트
- java
- lombok
- springboot
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함