| @@ -148,29 +148,37 @@ export default { | |||||
| params:this.params | params:this.params | ||||
| }).then((res)=>{ | }).then((res)=>{ | ||||
| this.array = res.data.topics | this.array = res.data.topics | ||||
| this.array.forEach((element,index) => { | this.array.forEach((element,index) => { | ||||
| if (this.arrayTopics.indexOf(element.topic_name)>-1){ | if (this.arrayTopics.indexOf(element.topic_name)>-1){ | ||||
| this.showInitTopic.push(true) | this.showInitTopic.push(true) | ||||
| }else{ | |||||
| } | |||||
| else{ | |||||
| this.showInitTopic.push(false) | this.showInitTopic.push(false) | ||||
| } | } | ||||
| this.showInputValue = true | |||||
| }); | |||||
| let findelement = this.array.some((item)=>{ | |||||
| return item.topic_name===this.input | |||||
| }) | |||||
| this.showInputValue = !findelement | |||||
| }); | |||||
| }) | }) | ||||
| this.showInputValue = true | |||||
| this.showSearchTopic = true | this.showSearchTopic = true | ||||
| } | } | ||||
| this.showAddTopic = false | this.showAddTopic = false | ||||
| }, | }, | ||||
| @@ -249,7 +257,7 @@ export default { | |||||
| this.Post(data,topics) | this.Post(data,topics) | ||||
| if(this.arrayTopics.length===0){ | if(this.arrayTopics.length===0){ | ||||
| console.log("add postTopic") | |||||
| $('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>') | $('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>') | ||||
| }else{ | }else{ | ||||
| $('#repo-topics1').children('span').remove() | $('#repo-topics1').children('span').remove() | ||||
| @@ -282,7 +290,9 @@ export default { | |||||
| this.input = '' | this.input = '' | ||||
| if (this.input === ''){ | if (this.input === ''){ | ||||
| this.array = this.arrayTopics | this.array = this.arrayTopics | ||||
| let data = [] | let data = [] | ||||
| this.showInitTopic = [] | this.showInitTopic = [] | ||||
| this.array.forEach((element,index) => { | this.array.forEach((element,index) => { | ||||
| @@ -301,6 +311,7 @@ export default { | |||||
| this.showInputValue = false | this.showInputValue = false | ||||
| this.showSearchTopic = true | this.showSearchTopic = true | ||||
| this.showAddTopic = false | |||||
| } | } | ||||
| stopPropagation(e); | stopPropagation(e); | ||||
| @@ -332,30 +343,30 @@ computed:{ | |||||
| }, | }, | ||||
| watch: { | watch: { | ||||
| input(newValue){ | |||||
| // input(newValue){ | |||||
| if (newValue === ''){ | |||||
| this.array = this.arrayTopics | |||||
| let data = [] | |||||
| this.showInitTopic = [] | |||||
| this.array.forEach((element,index) => { | |||||
| // if (newValue === ''){ | |||||
| // this.array = this.arrayTopics | |||||
| // let data = [] | |||||
| // this.showInitTopic = [] | |||||
| // this.array.forEach((element,index) => { | |||||
| let item = {} | |||||
| item.topic_name = element | |||||
| // let item = {} | |||||
| // item.topic_name = element | |||||
| data.push(item) | |||||
| this.showInitTopic.push(true) | |||||
| // data.push(item) | |||||
| // this.showInitTopic.push(true) | |||||
| }); | |||||
| // }); | |||||
| this.array = data | |||||
| // this.array = data | |||||
| this.showInputValue = false | |||||
| this.showSearchTopic = true | |||||
| } | |||||
| } | |||||
| // this.showInputValue = false | |||||
| // this.showSearchTopic = true | |||||
| // } | |||||
| // } | |||||
| }, | }, | ||||
| mounted() { | mounted() { | ||||
| const context = this | const context = this | ||||