Commit 28caa21c by 王志慧

封装select-tab

1 parent d0f59570
.sprite-icon { background-image: url(../images/sprite.png);background-size: 154px 116px;} .sprite-icon { background-image: url(../images/sprite.png);background-size: 154px 116px;}
.icon-active { width: 20px; height: 20px; background-position: 0px -96px;} .icon-active { width: 20px; height: 20px; background-position: 0px -96px;}
.icon-append { width: 32px; height: 32px; background-position: -54px 0px;}
.icon-appoint { width: 32px; height: 32px; background-position: 0px -54px;}
.icon-arrow { width: 7px; height: 11px; background-position: -138px -26px;} .icon-arrow { width: 7px; height: 11px; background-position: -138px -26px;}
.icon-avatar { width: 44px; height: 44px; background-position: 0px 0px;} .icon-avatar { width: 44px; height: 44px; background-position: 0px 0px;}
.icon-customer-active { width: 16px; height: 16px; background-position: -138px 0px;} .icon-customer-active { width: 16px; height: 16px; background-position: -138px 0px;}
.icon-customer-add { width: 28px; height: 20px; background-position: -96px -42px;} .icon-customer-add { width: 28px; height: 20px; background-position: -96px -42px;}
.icon-customer-copy { width: 18px; height: 20px; background-position: -90px -96px;} .icon-customer-copy { width: 18px; height: 20px; background-position: -90px -96px;}
.icon-customer-phone { width: 20px; height: 20px; background-position: -30px -96px;} .icon-customer-phone { width: 20px; height: 20px; background-position: -30px -96px;}
.icon-identifier { width: 20px; height: 20px; background-position: -60px -96px;}
.icon-open-arrow { width: 8px; height: 7px; background-position: -138px -47px;}
.icon-append { width: 32px; height: 32px; background-position: -54px 0px;}
.icon-appoint { width: 32px; height: 32px; background-position: 0px -54px;}
.icon-factory { width: 32px; height: 32px; background-position: -42px -54px;} .icon-factory { width: 32px; height: 32px; background-position: -42px -54px;}
.icon-follow { width: 32px; height: 32px; background-position: -96px 0px;}
\ No newline at end of file \ No newline at end of file
.icon-follow { width: 32px; height: 32px; background-position: -96px 0px;}
.icon-identifier { width: 20px; height: 20px; background-position: -60px -96px;}
.icon-open-arrow { width: 8px; height: 7px; background-position: -138px -47px;}
\ No newline at end of file \ No newline at end of file
<template>
<div class="select-tab flex" v-if="data.length > 0">
<template v-for="(i, index) in data">
<div @click="click(index)" :class="['item', tabIndex == index ? 'active' : '']" :key="index">{{ i }}</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: 'SelectBar',
props: {
list: {
type: Array,
default: () => {
return []
}
},
index: {
type: Number,
default: 0
},
updata: null
},
data () {
return {
tabIndex: this.index,
data: this.list
}
},
watch: {
'index' (n) {
this.tabIndex = n
},
'updata' (n) {
this.data = this.list
this.tabIndex = this.index
}
},
mounted () {
},
methods: {
click (tabIndex) {
this.tabIndex = tabIndex
this.$emit('change', tabIndex)
}
}
}
</script>
<style lang="scss" scoped>
.select-tab {
margin: 10px 16px;
height: 28px;
background: #ebeff5;
border-radius: 6px;
box-sizing: border-box;
.item {
font-size: 14px;
font-weight: 400;
color: #666666;
line-height: 28px;
flex: 1;
text-align: center;
}
.active {
height: 24px;
background: #ffffff;
box-shadow: 0px 1px 2px 0px rgba(94, 97, 102, 0.2);
border-radius: 4px;
border: 1px solid rgba(0, 0, 0, 0.04);
color: #3975c6;
line-height: 24px;
}
}
</style>
<template> <template>
<div class="customer-container"> <div class="customer-container">
<div class="customer-container-head"> <div class="customer-container-head">
<div class="font-16 color54 line-24">定保N-5</div> <div class="font-16 color54 line-24 title">定保N-5</div>
</div> <search :keyword="keyWord" placeholder="请输入关键字" @search="searchkeyWord"></search>
<select-bar :list="['全部','未跟进','未接听']" :index="currentIndex" @change="changeCurrent"></select-bar>
</div> </div>
</div>
</template> </template>
<script> <script>
export default { export default {
data() {
return {
keyWord: '',
currentIndex:0
}
},
methods: {
searchkeyWord(e) {
this.keyWord = e
},
changeCurrent(index){
console.log(index)
}
}
} }
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.customer-container{ .customer-container {
&-head{ &-head {
height:142px; height: 142px;
background: #fff; background: #fff;
} .title {
padding: 10px 16px;
}
}
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!