메일 보내기 페이지

8175 단어

<br> import {find, findIndex} from 'lodash'<br> export default {<br> computed: {},<br> data () {<br> return {email: '',<br> emailObj: [],<br> selIndex: '',<br> oldIndex: '',<br> emailFlag: false,<br> disFlag: true<br> }<br> },<br> methods: {<br> emailVerify () {<br> let filter = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/<br> this.emailFlag = filter.test(this.email)<br> if (this.email !== null) {<br> this.emailObj.push({'emailFlag': this.emailFlag, 'emails': this.email})<br> }<br> this.email = ''<br> let falseVal = find(this.emailObj, {'emailFlag': false})<br> if (falseVal === undefined) {<br> this.disFlag = false<br> }<br> },<br> editEmail (item) {<br> let index = findIndex(this.emailObj, {emails: item.emails})<br> let newIndex = document.getElementById(index)<br> let newColse = document.getElementsByName(index)[0]<br> newIndex.style.color = '#ffffff'<br> if (item.emailFlag === true) {<br> newIndex.style.backgroundColor = '#3990d8'<br> newColse.style.color = '#3990d8'<br> } else {<br> newIndex.style.backgroundColor = '#f56c6a'<br> newColse.style.color = '#f56c6a'<br> }<br><br> if (this.selIndex !== '' || this.selIndex !== index) {<br> newColse.style.display = 'block'<br> this.selIndex = index<br> if (this.oldIndex !== '') {<br> let old = document.getElementById(this.oldIndex)<br> document.getElementsByName(this.oldIndex)[0].style.display = 'none'<br> old.style.backgroundColor = ''<br> old.style.color = ''<br> }<br> }<br> },<br> deleteEmail (index) {<br> if (index === this.oldIndex) {<br> this.emailObj.splice(index, 1)<br> this.selIndex = ''<br> this.oldIndex = ''<br> document.getElementsByName(index)[0].style.display = 'none'<br> document.getElementById(index).style.backgroundColor = ''<br> document.getElementById(index).style.color = ''<br> }<br> let falseVal = find(this.emailObj, {'emailFlag': false})<br> if (falseVal === undefined) {<br> this.disFlag = false<br> }<br> },<br> send () {<br> console.log(this.emailObj)<br> }<br> },<br> watch: {<br> selIndex (oldVal, newVal) {<br> this.oldIndex = oldVal<br> }<br> },<br> props: {<br> }<br><br> }<br><br>


전재 대상:https://www.cnblogs.com/cxdxm/p/6800086.html

좋은 웹페이지 즐겨찾기