Ai
1 Star 0 Fork 0

bit212/TechDocs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.tag 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
Tsutomu Kawamura 提交于 2015-02-10 20:33 +08:00 . Create simple website with Riot.js
<app>
<logo title={ opts.title } />
<form>
<input type="search" value={ keyword } onkeyup={ keyup } placeholder="search">
</form>
<item each={ filtered } url={ url } language={ language } title={ title } />
<p if={ more }>and { count - MAX } more documents</p>
<footnote urls={ opts.urls } />
<style>
app {
display: block;
text-align: center;
color: #666;
}
app > form {
background: #72A7EE;
padding: 0 2em 2em;
margin-bottom: 1em;
}
app input[type=search] {
width: 100%;
font-size: 2em;
padding: .5em 0;
text-align: center;
outline: none;
border: 0;
border-radius: .2em;
background-color: rgba(255,255,255,.7);
transition: all .5s;
}
app input[type=search]:hover,
app input[type=search]:focus {
background-color: rgba(255,255,255,1);
box-shadow: 0 1px 5px rgba(0,0,0,.3);
}
app > p {
color: #ccc;
}
</style>
<script>
MAX = 20
init() {
this.keyword = ''
this.items = opts.items
this.filtered = []
this.count = 0
this.more = false
this.search()
}
keyup(e) {
this.keyword = e.target.value.trim().toLowerCase()
this.search()
}
search() {
filtered = this.items.filter(this.filter)
this.count = filtered.length
this.more = (filtered.length > MAX)
this.filtered = filtered.slice(0, MAX)
}
filter(item) {
return !this.keyword.length
|| item.id.replace(/\-\w\w$/, '').match(this.keyword)
}
this.init()
</script>
</app>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/bit212/TechDocs.git
git@gitee.com:bit212/TechDocs.git
bit212
TechDocs
TechDocs
css-preprocess

搜索帮助