2018-02-12 14:10:16 +02:00
|
|
|
<template>
|
2018-02-20 15:53:34 +02:00
|
|
|
<form class="search" @submit.prevent="onSubmit">
|
2018-02-12 14:10:16 +02:00
|
|
|
%fa:search%
|
2018-04-14 19:04:40 +03:00
|
|
|
<input v-model="q" type="search" placeholder="%i18n:@placeholder%"/>
|
2018-02-12 14:10:16 +02:00
|
|
|
<div class="result"></div>
|
|
|
|
</form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
q: ''
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onSubmit() {
|
2018-06-10 06:21:44 +03:00
|
|
|
if (this.q.startsWith('#')) {
|
|
|
|
this.$router.push(`/tags/${encodeURIComponent(this.q.substr(1))}`);
|
|
|
|
} else {
|
|
|
|
this.$router.push(`/search?q=${encodeURIComponent(this.q)}`);
|
|
|
|
}
|
2018-02-12 14:10:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-03-03 06:47:55 +02:00
|
|
|
@import '~const.styl'
|
2018-07-14 19:49:36 +03:00
|
|
|
root(isDark)
|
2018-02-12 14:10:16 +02:00
|
|
|
> [data-fa]
|
|
|
|
display block
|
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
left 0
|
|
|
|
width 48px
|
|
|
|
text-align center
|
|
|
|
line-height 48px
|
|
|
|
color #9eaba8
|
|
|
|
pointer-events none
|
|
|
|
|
|
|
|
> *
|
|
|
|
vertical-align middle
|
|
|
|
|
|
|
|
> input
|
|
|
|
user-select text
|
|
|
|
cursor auto
|
|
|
|
margin 8px 0 0 0
|
|
|
|
padding 6px 18px 6px 36px
|
|
|
|
width 14em
|
|
|
|
height 32px
|
|
|
|
font-size 1em
|
2018-04-29 02:51:17 +03:00
|
|
|
background rgba(#000, 0.05)
|
2018-02-12 14:10:16 +02:00
|
|
|
outline none
|
|
|
|
//border solid 1px #ddd
|
|
|
|
border none
|
|
|
|
border-radius 16px
|
|
|
|
transition color 0.5s ease, border 0.5s ease
|
2018-07-14 19:49:36 +03:00
|
|
|
color isDark ? #fff : #000
|
2018-02-12 14:10:16 +02:00
|
|
|
|
|
|
|
&::placeholder
|
|
|
|
color #9eaba8
|
|
|
|
|
|
|
|
&:hover
|
2018-07-14 19:49:36 +03:00
|
|
|
background isDark ? rgba(#fff, 0.04) : rgba(#000, 0.08)
|
2018-02-12 14:10:16 +02:00
|
|
|
|
|
|
|
&:focus
|
|
|
|
box-shadow 0 0 0 2px rgba($theme-color, 0.5) !important
|
|
|
|
|
2018-07-14 19:49:36 +03:00
|
|
|
.search[data-darkmode]
|
|
|
|
root(true)
|
|
|
|
|
|
|
|
.search:not([data-darkmode])
|
|
|
|
root(false)
|
2018-02-12 14:10:16 +02:00
|
|
|
</style>
|