Commit 84fcbb76 by liwk

commit

1 parent 5db1b23d
...@@ -21,6 +21,25 @@ img { ...@@ -21,6 +21,25 @@ img {
vertical-align: top; vertical-align: top;
} }
.flex {
display: flex;
align-items: center;
}
.text-hide {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-two-line {
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.text-center { .text-center {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -38,3 +57,7 @@ img { ...@@ -38,3 +57,7 @@ img {
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
.sticky {
position: static;
}
\ No newline at end of file \ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 170px 170px;}
.icon-coupon { width: 80px; height: 80px; background-position: 0px 0px;}
.icon-discount { width: 80px; height: 80px; background-position: -90px 0px;}
.icon-exchange { width: 80px; height: 80px; background-position: 0px -90px;}
\ No newline at end of file \ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 10px 10px;}
.icon-attract-customer-share { width: 10px; height: 10px; background-position: 0px 0px;}
\ No newline at end of file \ No newline at end of file

21.8 KB | W: | H:

427 Bytes | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<div :class="['scroll-view', ScrollViewclass]">
<van-list <van-list
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
...@@ -9,6 +10,7 @@ ...@@ -9,6 +10,7 @@
> >
<slot></slot> <slot></slot>
</van-list> </van-list>
</div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
...@@ -20,17 +22,20 @@ export default { ...@@ -20,17 +22,20 @@ export default {
finished: false, finished: false,
} }
}, },
props: ['ScrollViewclass'],
mounted () { mounted () {
}, },
methods: { methods: {
onLoad () { onLoad () {
this.loading = false this.$emit('ReachBottom')
this.finished = true
this.$emit('ReachBottom', null)
}, },
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.scroll-view {
overflow-y: scroll;
box-sizing: border-box;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="search">
<van-search
v-model="value"
:placeholder="placeholder"
@search="onSearch"
/>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'Search',
props: {
keyword: {
type: String,
default: ''
},
placeholder: {
type: String,
default: '请输入内容搜索'
}
},
data () {
return {
value: this.keyword
}
},
mounted () {
},
methods: {
onSearch (e) {
this.$emit('search', e)
}
}
}
</script>
<style scoped lang='scss'>
.van-search {
padding: 9px 16px;
height: 50px;
background: #fff;
.van-search__content {
background-color: #fff;
border: 1px solid #cdd1d4;
border-radius: 16px;
}
.van-cell {
padding: 5px 16px 5px 0;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="tab"> <div :class="[{'sticky':sticky}]">
<van-tabs
v-model="tabIndex"
color="#5850ff"
title-inactive-color="#BBB"
title-active-color="#2c2c2c"
@click="click"
:key="updata"
>
<template v-for="(i,index) in data"> <template v-for="(i,index) in data">
<div <van-tab
@click="change(index)" :title="i"
:class="['item' ,'text-center', {'active':index == tabIndex}]"
:key="index" :key="index"
>{{i}}</div> ></van-tab>
</template> </template>
<div :class="['line',`type-${tabIndex}`]"></div> </van-tabs>
</div> </div>
</template> </template>
...@@ -15,22 +22,38 @@ ...@@ -15,22 +22,38 @@
export default { export default {
name: 'Tab', name: 'Tab',
props: { props: {
data: { list: {
type: Array, type: Array,
default: () => { default: () => {
return [] return []
} }
} },
sticky: Boolean,
index: {
type: Number,
default: 0
},
updata: null
}, },
data () { data () {
return { return {
tabIndex: 0 tabIndex: this.index,
data: this.list
}
},
watch: {
'index' (n) {
this.tabIndex = n
},
'updata' (n) {
this.data = this.list
this.tabIndex = this.index
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
change (tabIndex) { click (tabIndex) {
this.tabIndex = tabIndex this.tabIndex = tabIndex
this.$emit('change', tabIndex) this.$emit('change', tabIndex)
} }
...@@ -38,40 +61,19 @@ export default { ...@@ -38,40 +61,19 @@ export default {
} }
</script> </script>
<style scoped lang='scss'> <style lang='scss'>
.tab { .sticky {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 2; z-index: 99;
display: grid; }
grid-template-columns: repeat(2, 1fr); .van-tabs__wrap {
background-color: #fff; height: 50px !important;
height: 44px; }
.item { .van-tab__text {
color: #a9a9a9;
font-size: 14px;
transition: all 0.5s;
}
.active {
font-size: 16px;
color: #2c2c2c;
font-weight: 500;
}
.line {
position: absolute;
bottom: 0;
background: #5850ff;
border-radius: 2px;
height: 3px;
width: 40px;
transform: translateX(-50%);
transition: all 0.25s; transition: all 0.25s;
} }
.type-0 { .van-tab--active {
left: 25%; font-size: 16px !important;
}
.type-1 {
left: 75%;
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -9,9 +9,13 @@ ...@@ -9,9 +9,13 @@
// 按需全局引入 vant组件 // 按需全局引入 vant组件
import { import {
Button, Button,
Dialog Dialog,
Search,
List,
} from 'vant' } from 'vant'
export const components = [ export const components = [
Button, Button,
Dialog Dialog,
Search,
List
] ]
\ No newline at end of file \ No newline at end of file
...@@ -5,7 +5,8 @@ const pages = { ...@@ -5,7 +5,8 @@ const pages = {
attractCustomer: [{ attractCustomer: [{
name: 'index', name: 'index',
meta: { meta: {
title: '渠道货吗' title: '渠道活码',
backgroundColor: '#F7F7F7'
} }
}] }]
} }
......
<template> <template>
<div> <div class="layout">
渠道活码 <div class="search sticky">
<search />
</div>
<div class="content">
<scroll-view
class="list-box"
@ReachBottom="onReachBottom"
ref="scrollView"
>
<template v-for="(i,index) in 10">
<div
class="box"
:key="index"
>
<div class="share">
<div class="sprite-icon icon-attract-customer-share"></div>
</div>
<div class="title text-hide">渠道活码名称大概到这个位置…</div>
<div class="name-list">
<div class="label"></div>
<div class="value"></div>
</div>
<div class="remark">
备注:{{i.remark || ''}}
</div>
</div>
</template>
</scroll-view>
</div>
</div> </div>
</template> </template>
...@@ -14,9 +42,39 @@ export default { ...@@ -14,9 +42,39 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.layout {
.search {
top: 0;
z-index: 2;
background-color: #fff;
}
.content {
padding: 16px;
.box {
background: #ffffff;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
padding: 16px 10px;
margin-bottom: 10px;
position: relative;
.share {
position: absolute;
right: 0;
top: 0;
}
.title {
width: 224px;
color: #333333;
font-size: 16px;
font-weight: 500;
}
}
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!