|
<template name='local-service-list'>
<view class="page">
<a-header onClickLeft="headerLeftClickedHandler" right-icon>本地服务</a-header>
<safe-area>
<view class="tab-wap" id="tabs">
<text v-for="(item, index) in tabs" :class={item.class} @click="tabClickHandler(index, item.id)">{{ item.title }}</text>
</view>
</safe-area>
</view>
</template>
<script>
import AHeader from '../../components/a-header.stml'
export default {
name: 'local-service-list',
apiready(){//like created
},
data() {
return{
tabs: [
{id: 'treatment', title: '医疗', class: 'tab__active'},
{id: 'board', title: '寄养', class: 'tab'},
{id: 'other', title: '其他', class: 'tab'}
]
}
},
methods: {
tabClickHandler(index, id, changeFrame = true) {
if (changeFrame) {
api.setFrameGroupIndex({
name: 'mainGroup',
scroll: true,
index: index
})
}
this.data.tabs.filter(value => {
value.class = 'tab'
return value.id === id
})[0].class = 'tab__active'
},
scrollHandler(ev) {
console.log(JSON.stringify(ev.detail))
},
headerLeftClickedHandler() {
api.closeWin()
api.setStatusBarStyle({
style: 'dark',
color: 'rgba(0,0,0,0)',
animated: true
})
}
}
}
</script> |
|