搜索优化

This commit is contained in:
结发受长生 2018-06-19 11:56:37 +08:00
parent e9f800303d
commit 0b0053c07e
7 changed files with 14 additions and 15 deletions

View File

@ -1,3 +1,3 @@
<a href="<%- url_for(post.path) %>" class="<%= class_name %>">
<a href="<%- url_for('/archives'+date(post.date, '/YYYY/MM')) %>" class="<%= class_name %>">
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><i class="icon-calendar icon"></i><%= date(post.date, date_format) %></time>
</a>

View File

@ -1 +1 @@
<%- js('js/mobile.cfb38e2874478d984279.js') %> <%- js('js/slider.a6b92350b3a9ce92ddd9.js') %> <%- js('js/main.34802c21ea4824f2ae00.js') %>
<%- js('js/mobile.cfb38e2874478d984279.js') %> <%- js('js/slider.5ca5d3094d7d23f182cf.js') %> <%- js('js/main.34802c21ea4824f2ae00.js') %>

View File

@ -91,13 +91,13 @@
<i class="icon-calendar icon"></i>
<span >{{item.date|dateformat}}</span>
</p>
<p class="search-category">
<i class="icon-book icon"></i>
<span v-for="category in item.categories" @click="chose(category.name, '$')" >{{'$'+category.name}}</span>
<p class="search-category" v-if="item.categories.length">
<i class="icon-book icon" ></i>
<span v-for="category in item.categories" @click="chose(category.name, '$')" >{{category.name}}</span>
</p>
<p class="search-tag">
<i class="icon-price-tags icon"></i>
<span v-for="tag in item.tags" @click="chose(tag.name, '#')" >{{'#'+tag.name}}</span>
<p class="search-tag" v-if="item.tags.length">
<i class="icon-price-tags icon" ></i>
<span v-for="tag in item.tags" @click="chose(tag.name, '#')" >{{tag.name}}</span>
</p>
</li>
</ul>
@ -124,5 +124,4 @@
</section>
<%}%>
</div>
</div>

View File

@ -3,8 +3,8 @@
"version": "4.0.0",
"description": "a theme for hexo",
"scripts": {
"dev": "webpack",
"dist": "webpack -p"
"dev": "webpack --watch",
"build": "webpack -p"
},
"repository": {
"type": "git",

View File

@ -113,12 +113,12 @@ function handleSearch(val) {
break
case 'tag' :
item.isHide = Array.prototype.every.call(item.tags, function(tag){
return tag.name.toLowerCase().indexOf(val) < 0
return tag.name.toLowerCase() !== val
})
break
case 'category' :
item.isHide = Array.prototype.every.call(item.categories, function(category){
return category.name.toLowerCase().indexOf(val) < 0
return category.name.toLowerCase() !== val
})
break
}

View File

@ -73,5 +73,5 @@ module.exports = {
dry: false,
})
],
watch: true
// watch: true
}