page header

This commit is contained in:
cookfront 2017-04-13 14:28:26 +08:00
parent 18a2163bc7
commit 5a63e79ca7
3 changed files with 59 additions and 25 deletions

View File

@ -1,6 +1,7 @@
<template><section class="demo-cell"><h1 class="demo-title">cell</h1><example-block title="基础用法"> <template><section class="demo-cell"><h1 class="demo-title">cell</h1><example-block title="基础用法">
<zan-cell-group> <zan-cell-group>
<zan-cell title="单元格1" value="单元格1内容"></zan-cell> <zan-cell title="单元格1" value="单元格1内容">
</zan-cell>
<zan-cell title="单元格2" value="单元格2内容"></zan-cell> <zan-cell title="单元格2" value="单元格2内容"></zan-cell>
</zan-cell-group> </zan-cell-group>

View File

@ -125,6 +125,16 @@
<span>contact</span> <span>contact</span>
</zan-col> </zan-col>
</zan-row> </zan-row>
<zan-row>
<zan-col span="8">
<zan-icon name="wechat"></zan-icon>
<span>wechat</span>
</zan-col>
<zan-col span="8">
<zan-icon name="alipay"></zan-icon>
<span>alipay</span>
</zan-col>
</zan-row>
</example-block></section></template> </example-block></section></template>
<style> <style>

View File

@ -1,5 +1,6 @@
<template> <template>
<div class="page-header"> <div class="page-header">
<div class="page-header__top">
<h1 class="page-header__logo"> <h1 class="page-header__logo">
<a href="#"></a> <a href="#"></a>
</h1> </h1>
@ -17,7 +18,8 @@
<a href="https://github.com/youzan/zanui-weapp" class="page-header__link">微信小程序</a> <a href="https://github.com/youzan/zanui-weapp" class="page-header__link">微信小程序</a>
</li> </li>
</ul> </ul>
<ul class="page-header__subnavs"> </div>
<ul class="page-header__subnavs" :class="{ 'page-header__subnavs--shadow': scrollTop > 0 }">
<li class="page-header__item"> <li class="page-header__item">
<a href="http://zanui.qima-inc.com/vue" class="page-header__link page-header__link--active">基础组件</a> <a href="http://zanui.qima-inc.com/vue" class="page-header__link page-header__link--active">基础组件</a>
</li> </li>
@ -38,8 +40,21 @@
export default { export default {
data() { data() {
return { return {
version: window._global.version version: window._global.version,
scrollTop: 0
}; };
},
mounted() {
const _this = this;
let timer;
window.addEventListener('scroll', () => {
clearTimeout(timer);
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
let timer = setTimeout(() => {
_this.scrollTop = scrollTop;
}, 500);
});
} }
}; };
</script> </script>
@ -51,8 +66,13 @@ export default {
top: 0; top: 0;
z-index: 1; z-index: 1;
width: 100%; width: 100%;
@e top {
overflow: hidden;
height: 60px; height: 60px;
background-color: #fbfbfb; background-color: #fbfbfb;
box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}
@e logo { @e logo {
float: left; float: left;
@ -78,13 +98,16 @@ export default {
} }
@e subnavs { @e subnavs {
position: absolute;
line-height: 50px; line-height: 50px;
top: 60px;
display: flex; display: flex;
justify-content: center; justify-content: center;
width: 100%;
background-color: #f2f2f2; background-color: #f2f2f2;
position: relative;
z-index: -1;
@m shadow {
box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}
a, a,
span { span {