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