Front-end Vue custom free scrolling news bar tabs tab tab bar title bar component

With the development of technology, the complexity of development is getting higher and higher. The traditional development method makes a system into a whole application. It often happens that a small change or a small function increase may cause the overall logic to change. Modifications, causing the whole body to be affected by a single hair.

Through component development, separate development and maintenance can be effectively realized, and they can be combined at will. Greatly improve development efficiency and reduce maintenance costs.

Today I will introduce a component front-end Vue custom free scrolling news bar tabs tab tab bar title bar component; the source code download address is attached : https://ext.dcloud.net.cn/plugin?id=13615

The renderings are as follows:

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-ZCf2b3bw-1689545537432)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp /c84a531bf13141bd87bd4f1594d5e40b~tplv-k3u1fbpfcp-zoom-1.image)]

cc-newsTabs

Instructions


<!-- tabArr:tab数组 tabChange:标签栏切换 -->

<cc-newsTabs :tabArr="tabArr" @tabChange="tabChange"></cc-newsTabs>

//初始化数据

tabArr: [{

name: '关注',

id: '1',

},

{

name: '推荐',

id: '2'

},

{

name: '体育',

id: '3'

},

{

name: '热点',

id: '4'

},

{

name: '财经',

id: '5'

},

{

name: '娱乐',

id: '6'

},

{

name: '军事',

id: '7'

},

{

name: '历史',

id: '8'

},

{

name: '本地',

id: '9'

}],

// tab标签栏改变事件

tabChange(currentIndex) {

uni.showModal({

title: "当前选择序列",

content: "当前选择序列 = " + currentIndex

})

}

HTML code implementation part


<template>

<view class="content">

<!-- tabArr:tab数组 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: '财经',

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>

Guess you like

Origin blog.csdn.net/chenchuang0128/article/details/131758159