Fix #1144
This commit is contained in:
		
							parent
							
								
									341618a9d5
								
							
						
					
					
						commit
						eebbfb55d4
					
				
					 1 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
					@ -87,9 +87,15 @@ export default Vue.extend({
 | 
				
			||||||
			el.addEventListener('mousedown', this.onMousedown);
 | 
								el.addEventListener('mousedown', this.onMousedown);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.$nextTick(() => {
 | 
				
			||||||
			this.exec();
 | 
								this.exec();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.$watch('q', this.exec);
 | 
								this.$watch('q', () => {
 | 
				
			||||||
 | 
									this.$nextTick(() => {
 | 
				
			||||||
 | 
										this.exec();
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	beforeDestroy() {
 | 
						beforeDestroy() {
 | 
				
			||||||
		this.textarea.removeEventListener('keydown', this.onKeydown);
 | 
							this.textarea.removeEventListener('keydown', this.onKeydown);
 | 
				
			||||||
| 
						 | 
					@ -100,6 +106,13 @@ export default Vue.extend({
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {
 | 
						methods: {
 | 
				
			||||||
		exec() {
 | 
							exec() {
 | 
				
			||||||
 | 
								this.select = -1;
 | 
				
			||||||
 | 
								if (this.$refs.suggests) {
 | 
				
			||||||
 | 
									Array.from(this.items).forEach(el => {
 | 
				
			||||||
 | 
										el.removeAttribute('data-selected');
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (this.type == 'user') {
 | 
								if (this.type == 'user') {
 | 
				
			||||||
				const cache = sessionStorage.getItem(this.q);
 | 
									const cache = sessionStorage.getItem(this.q);
 | 
				
			||||||
				if (cache) {
 | 
									if (cache) {
 | 
				
			||||||
| 
						 | 
					@ -168,6 +181,10 @@ export default Vue.extend({
 | 
				
			||||||
					cancel();
 | 
										cancel();
 | 
				
			||||||
					this.selectNext();
 | 
										this.selectNext();
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									default:
 | 
				
			||||||
 | 
										e.stopPropagation();
 | 
				
			||||||
 | 
										this.textarea.focus();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue