Skip to content

Commit

Permalink
💄 search
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Nov 29, 2017
1 parent d495687 commit 3185a6c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
21 changes: 14 additions & 7 deletions console/pages/admin/articles/index.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<div class="card">
<div class="card__body fn-flex" v-show="!isBatch">
<v-text-field v-if="list.length > 0"
@keyup.enter="getList()"
<v-text-field v-if="list.length > 0 || isSearch"
@keyup.enter="getList();isSearch = true"
class="fn-flex-1"
:label="$t('enterSearch', $store.state.locale)"
v-model="keyword">
</v-text-field>
<nuxt-link to="/admin/articles/post" class="btn btn--success" :class="{'btn--new': list.length > 0}">{{ $t('new', $store.state.locale)
<nuxt-link to="/admin/articles/post" class="btn btn--success" :class="{'btn--new': list.length > 0 || isSearch}">{{ $t('new', $store.state.locale)
}}
</nuxt-link>
</div>
Expand Down Expand Up @@ -59,16 +59,16 @@
:nudge-left="60"
:open-on-hover="true">
<v-toolbar-title slot="activator">
<nuxt-link class="btn btn--small btn--info" :to="`/admin/articles/post?id=${item.id}`">
<v-btn class="btn--small btn--info" @click.stop="goEdit(item.id)">
{{ $t('edit', $store.state.locale) }}
<v-icon>arrow_drop_down</v-icon>
</nuxt-link>
</v-btn>
</v-toolbar-title>
<v-list>
<v-list-tile class="list__tile--link" @click="goEdit(item.id)">
<v-list-tile class="list__tile--link" @click.stop="goEdit(item.id)">
{{ $t('edit', $store.state.locale) }}
</v-list-tile>
<v-list-tile class="list__tile--link" @click="remove(item.id)">
<v-list-tile class="list__tile--link" @click.stop="remove(item.id)">
{{ $t('delete', $store.state.locale) }}
</v-list-tile>
</v-list>
Expand All @@ -86,6 +86,12 @@
</div>
</li>
</ul>
<ul class="list" v-else-if="isSearch && !isBatch">
<li class="fn-flex fn-pointer" @click="isSearch = false;keyword = '';getList();">
{{ $t('searchNull', $store.state.locale) }} &nbsp;
<span class="ft-danger">{{keyword}}</span>
</li>
</ul>
<div class="pagination--wrapper fn-clear" v-if="pageCount > 1">
<v-pagination
:length="pageCount"
Expand All @@ -105,6 +111,7 @@
export default {
data () {
return {
isSearch: false,
isSelectAll: false,
isBatch: false,
selectedIds: [],
Expand Down
15 changes: 11 additions & 4 deletions console/pages/admin/comments/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<div class="card">
<div class="card__body" v-show="!isBatch">
<v-text-field
v-if="list.length > 0"
@keyup.enter="getList()"
v-if="list.length > 0 || isSearch"
@keyup.enter="isSearch = true; getList()"
class="fn-flex-1"
:label="$t('enterSearch', $store.state.locale)"
v-model="keyword">
</v-text-field>
<div v-else>
<div v-if="list.length < 1 && !isSearch">
{{ $t('noData', $store.state.locale) }}
</div>
</div>
Expand Down Expand Up @@ -59,7 +59,7 @@
v-show="!isBatch"
v-if="$store.state.name === item.author.name || $store.state.role < 3"
class="btn btn--danger btn--small"
@click="remove(item.id)">{{ $t('delete', $store.state.locale) }}
@click.stop="remove(item.id)">{{ $t('delete', $store.state.locale) }}
</v-btn>
</div>
</div>
Expand All @@ -70,6 +70,12 @@
</div>
</li>
</ul>
<ul class="list" v-else-if="isSearch && !isBatch">
<li class="fn-flex fn-pointer" @click="isSearch = false;keyword = '';getList();">
{{ $t('searchNull', $store.state.locale) }} &nbsp;
<span class="ft-danger">{{keyword}}</span>
</li>
</ul>
<div class="pagination--wrapper fn-clear" v-if="pageCount > 1">
<v-pagination
:length="pageCount"
Expand All @@ -89,6 +95,7 @@
export default {
data () {
return {
isSearch: false,
isSelectAll: false,
isBatch: false,
selectedIds: [],
Expand Down
3 changes: 2 additions & 1 deletion i18n/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,6 @@
"orderedList": "有序列表",
"unorderedList": "无序列表",
"fullscreen": "全屏",
"question": "帮助"
"question": "帮助",
"searchNull": "搜索结果为空,清空关键字"
}

0 comments on commit 3185a6c

Please sign in to comment.