隨著技術的發(fā)展,開發(fā)的復雜度也越來越高,傳統(tǒng)開發(fā)方式將一個系統(tǒng)做成了整塊應用,經(jīng)常出現(xiàn)的情況就是一個小小的改動或者一個小功能的增加可能會引起整體邏輯的修改,造成牽一發(fā)而動全身。
通過組件化開發(fā),可以有效實現(xiàn)單獨開發(fā),單獨維護,而且他們之間可以隨意的進行組合。大大提升開發(fā)效率低,降低維護成本。
今天給大家介紹的一款組件前端Vue自定義可自由滾動新聞欄tabs選項卡標簽欄標題欄組件;閱讀全文下載完整代碼請關注微信公眾號: 前端組件開發(fā)
效果圖如下:
文章來源:http://www.zghlxwxcb.cn/news/detail-594358.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-594358.html
cc-newsTabs
使用方法
<!-- tabArr:tab數(shù)組 tabChange:標簽欄切換 -->
<cc-newsTabs :tabArr="tabArr" @tabChange="tabChange"></cc-newsTabs>
//初始化數(shù)據(jù)
tabArr: [{
name: '關注',
id: '1',
},
{
name: '推薦',
id: '2'
},
{
name: '體育',
id: '3'
},
{
name: '熱點',
id: '4'
},
{
name: '財經(jīng)',
id: '5'
},
{
name: '娛樂',
id: '6'
},
{
name: '軍事',
id: '7'
},
{
name: '歷史',
id: '8'
},
{
name: '本地',
id: '9'
}],
// tab標簽欄改變事件
tabChange(currentIndex) {
uni.showModal({
title: "當前選擇序列",
content: "當前選擇序列 = " + currentIndex
})
}
HTML代碼實現(xiàn)部分
<template>
<view class="content">
<!-- tabArr:tab數(shù)組 tabChange:標簽欄切換 -->
<cc-newsTabs :tabArr="tabArr" @tabChange="tabChange"></cc-newsTabs>
</view>
</template>
<script>
export default {
data() {
return {
tabArr: [{
name: '關注',
id: '1',
}, {
name: '推薦',
id: '2'
}, {
name: '體育',
id: '3'
}, {
name: '熱點',
id: '4'
}, {
name: '財經(jīng)',
id: '5'
}, {
name: '娛樂',
id: '6'
}, {
name: '軍事',
id: '7'
}, {
name: '歷史',
id: '8'
}, {
name: '本地',
id: '9'
}],
}
},
methods: {
tabChange(currentIndex) {
uni.showModal({
title: "當前選擇序列",
content: "當前選擇序列 = " + currentIndex
})
}
}
}
</script>
<style>
page,
.content {
background-color: #f8f8f8;
height: 100%;
overflow: hidden;
}
</style>
到了這里,關于前端Vue自定義可自由滾動新聞欄tabs選項卡標簽欄標題欄組件的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!