模仿腾讯视频滑动顶栏

2016-05-23  本文已影响40人  81fe5084e6c1

```

html

<header>

{{l}}

</header>

js

```

new Vue({

el: 'body',

data: {

list: ['精选', '跑男', '电视剧', '电影', '综艺', '原创', '原创', '原创', '原创', '原创', '原创', '原创', '原创']

},

computed: {

listWidth: function() {

return {

width: (this.list.length * 4) + 'rem'

}

}

}

})

css

* {

box-sizing: border-box;

}

body {

color: #666;

font-size: 16px;

}

header {

display:flex;

flex-flow:row;

width: 100%;

height: 2rem;

margin: 0 auto;

background-color: #fff;

}

list {

flex: 1;

overflow: auto;

}

list ul {

display: flex;

flex-flow: row;

list-style: none;

height: 2rem;

line-height: 2rem;

margin: 0;

padding: 0;

}

list ul li {

flex: 1;

width: 4rem;

text-align: center;

color

}

icon {

display: flex;

flex-flow: column;

justify-content: space-between;

padding: .5rem;

width: 2rem;

background-color: #2C9E40;

cursor: pointer;

z-index: 2;

}

icon > span {

height: 2px;

background-color: #fff;

}

上一篇 下一篇

猜你喜欢

热点阅读