| @@ -3,22 +3,22 @@ | |||
| <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> | |||
| <div class="scrolling-menu"> | |||
| <div v-if="showSearchTopic" class="item-text" v-for="(arr,i) in array" @click="addTopics(i,arr)"> | |||
| <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 class="text">{{arr.topic_name}} </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>标签 | |||
| </div> | |||
| <div v-if="showAddTopic" class="item-text" @click="addPostTopic"> | |||
| <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 class="text">{{input}}</div> | |||
| </div> | |||
| @@ -100,7 +100,7 @@ export default { | |||
| }, | |||
| changeValue(){ | |||
| console.log("changevalue") | |||
| if (this.input === ''){ | |||
| this.array = this.arrayTopics | |||
| let data = [] | |||
| @@ -128,6 +128,7 @@ export default { | |||
| this.showSearchTopic = false | |||
| }else{ | |||
| this.showInitTopic = [] | |||
| let timestamp=new Date().getTime() | |||
| this.params.q = this.input | |||
| @@ -136,11 +137,10 @@ export default { | |||
| params:this.params | |||
| }).then((res)=>{ | |||
| this.array = res.data.topics | |||
| }) | |||
| this.array.forEach((element,index) => { | |||
| this.array.forEach((element,index) => { | |||
| if (this.arrayTopics.indexOf(element.topic_name)>-1){ | |||
| this.showInitTopic.push(true) | |||
| }else{ | |||
| @@ -150,6 +150,10 @@ export default { | |||
| }); | |||
| }) | |||
| this.showInputValue = true | |||
| this.showSearchTopic = true | |||
| @@ -241,8 +245,7 @@ export default { | |||
| editDiv.css('display', ''); // show Semantic UI Grid | |||
| this.input = '' | |||
| console.log("this.",this) | |||
| console.log("-----------------asdasd",$("#topics_input"),$("#topics_input").val()) | |||
| stopPropagation(e); | |||
| }); | |||
| @@ -273,7 +276,7 @@ computed:{ | |||
| watch: { | |||
| input(newValue){ | |||
| console.log("---newvalue--",newValue) | |||
| if (newValue === ''){ | |||
| this.array = this.arrayTopics | |||
| let data = [] | |||
| @@ -311,7 +314,7 @@ mounted() { | |||
| this.changeValue() | |||
| } , | |||
| created(){ | |||
| console.log("this.created"); | |||
| this.initTopics(); | |||
| this.input='' | |||