| @@ -3,22 +3,22 @@ | |||||
| <div class="input-search"> | <div class="input-search"> | ||||
| <el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input"> | |||||
| <el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input" @keyup.enter.native="postTopic"> | |||||
| </el-input> | </el-input> | ||||
| <div class="scrolling-menu"> | <div class="scrolling-menu"> | ||||
| <div v-if="showSearchTopic" class="item-text" v-for="(arr,i) in array" @click="addTopics(i,arr)"> | <div v-if="showSearchTopic" class="item-text" v-for="(arr,i) in array" @click="addTopics(i,arr)"> | ||||
| <div class="icon-wrapper"> | <div class="icon-wrapper"> | ||||
| <i style="line-height: 1.5;" v-if="showInitTopic[i]" class="el-icon-check" ></i> | |||||
| <i style="vertical-align: middle;color: #303643;" v-if="showInitTopic[i]" class="el-icon-check" ></i> | |||||
| </div> | </div> | ||||
| <div class="text">{{arr.topic_name}} </div> | <div class="text">{{arr.topic_name}} </div> | ||||
| </div> | </div> | ||||
| <div v-if="showInputValue" class="addition item-text" @click="postTopic"> | |||||
| <div v-if="showInputValue" class="addition item-text" @click="postTopic"> | |||||
| 点击或回车添加<b class="user-add-label-text">{{input}}</b>标签 | 点击或回车添加<b class="user-add-label-text">{{input}}</b>标签 | ||||
| </div> | </div> | ||||
| <div v-if="showAddTopic" class="item-text" @click="addPostTopic"> | <div v-if="showAddTopic" class="item-text" @click="addPostTopic"> | ||||
| <div class="icon-wrapper"> | <div class="icon-wrapper"> | ||||
| <i style="line-height: 1.5;" v-if="showAddFlage" class="el-icon-check" ></i> | |||||
| <i style="vertical-align: middle;color: #303643;" v-if="showAddFlage" class="el-icon-check" ></i> | |||||
| </div> | </div> | ||||
| <div class="text">{{input}}</div> | <div class="text">{{input}}</div> | ||||
| </div> | </div> | ||||
| @@ -100,7 +100,7 @@ export default { | |||||
| }, | }, | ||||
| changeValue(){ | changeValue(){ | ||||
| console.log("changevalue") | |||||
| if (this.input === ''){ | if (this.input === ''){ | ||||
| this.array = this.arrayTopics | this.array = this.arrayTopics | ||||
| let data = [] | let data = [] | ||||
| @@ -128,6 +128,7 @@ export default { | |||||
| this.showSearchTopic = false | this.showSearchTopic = false | ||||
| }else{ | }else{ | ||||
| this.showInitTopic = [] | this.showInitTopic = [] | ||||
| let timestamp=new Date().getTime() | let timestamp=new Date().getTime() | ||||
| this.params.q = this.input | this.params.q = this.input | ||||
| @@ -136,11 +137,10 @@ 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{ | ||||
| @@ -150,6 +150,10 @@ export default { | |||||
| }); | }); | ||||
| }) | |||||
| this.showInputValue = true | this.showInputValue = true | ||||
| this.showSearchTopic = true | this.showSearchTopic = true | ||||
| @@ -241,8 +245,7 @@ export default { | |||||
| editDiv.css('display', ''); // show Semantic UI Grid | editDiv.css('display', ''); // show Semantic UI Grid | ||||
| this.input = '' | this.input = '' | ||||
| console.log("this.",this) | |||||
| console.log("-----------------asdasd",$("#topics_input"),$("#topics_input").val()) | |||||
| stopPropagation(e); | stopPropagation(e); | ||||
| }); | }); | ||||
| @@ -273,7 +276,7 @@ computed:{ | |||||
| watch: { | watch: { | ||||
| input(newValue){ | input(newValue){ | ||||
| console.log("---newvalue--",newValue) | |||||
| if (newValue === ''){ | if (newValue === ''){ | ||||
| this.array = this.arrayTopics | this.array = this.arrayTopics | ||||
| let data = [] | let data = [] | ||||
| @@ -311,7 +314,7 @@ mounted() { | |||||
| this.changeValue() | this.changeValue() | ||||
| } , | } , | ||||
| created(){ | created(){ | ||||
| console.log("this.created"); | |||||
| this.initTopics(); | this.initTopics(); | ||||
| this.input='' | this.input='' | ||||