[Client] Resolve #2951

あと検索フォームでサジェストを有効に
This commit is contained in:
syuilo
2018-12-16 08:45:10 +09:00
parent 2faa58928f
commit b7c5c71c6f
7 changed files with 31 additions and 18 deletions

View File

@@ -17,12 +17,12 @@
<a v-for="tag in recentHashtags.slice(0, 5)" @click="addTag(tag)" :title="$t('click-to-tagging')">#{{ tag }}</a>
</div>
<div class="local-only" v-if="localOnly == true">{{ $t('local-only-message') }}</div>
<input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('annotations')" v-autocomplete="'cw'">
<input v-show="useCw" ref="cw" v-model="cw" :placeholder="$t('annotations')" v-autocomplete="{ model: 'cw' }">
<div class="textarea">
<textarea :class="{ with: (files.length != 0 || poll) }"
ref="text" v-model="text" :disabled="posting"
@keydown="onKeydown" @paste="onPaste" :placeholder="placeholder"
v-autocomplete="'text'"
v-autocomplete="{ model: 'text' }"
></textarea>
<button class="emoji" @click="emoji" ref="emoji">
<fa :icon="['far', 'laugh']"/>

View File

@@ -1,7 +1,7 @@
<template>
<form class="search" @submit.prevent="onSubmit">
<form class="wlvfdpkp" @submit.prevent="onSubmit">
<i><fa icon="search"/></i>
<input v-model="q" type="search" :placeholder="$t('placeholder')"/>
<input v-model="q" type="search" :placeholder="$t('placeholder')" v-autocomplete="{ model: 'q' }"/>
<div class="result"></div>
</form>
</template>
@@ -19,10 +19,13 @@ export default Vue.extend({
},
methods: {
onSubmit() {
if (this.q.startsWith('#')) {
this.$router.push(`/tags/${encodeURIComponent(this.q.substr(1))}`);
const q = this.q.trim();
if (q.startsWith('@')) {
this.$router.push(`/${q}`);
} else if (q.startsWith('#')) {
this.$router.push(`/tags/${encodeURIComponent(q.substr(1))}`);
} else {
this.$router.push(`/search?q=${encodeURIComponent(this.q)}`);
this.$router.push(`/search?q=${encodeURIComponent(q)}`);
}
}
}
@@ -30,7 +33,7 @@ export default Vue.extend({
</script>
<style lang="stylus" scoped>
.search
.wlvfdpkp
@media (max-width 800px)
display none !important