具体代码如下所述:

1111
2222

export default {

name: "swiper",

data() {

return {

navlist:[

{name:'热门答疑'},

{name:'北清状元'}

],

nowindex:0,

}

},

components:{

},

mounted() {

var that=this

that.myswiper = new swiper('.swiper-container',{

initialslide:0,

autoplay:false,

keyboardcontrol:true,

autoheight:true,

observer:true,

observeparents:true,

onslidechangestart:function(){

// console.log(that.myswiper.activeindex)

that.nowindex=that.myswiper.activeindex

}

});

// this.getlist();

},

methods: {

tabclick(index){

this.nowindex = index

this.myswiper.slideto(index,1000,false)

},

},

created(id){

}

}

.navlist{

width:100%;

height:40px;

border-bottom:1px solid rgba(151,151,151,0.1);

position:relative;

}

.navli{

padding:10px 0px;

text-align:center;

float:left;

margin:0 1.2rem;

}

.navli i{

font-style: normal;

font-size: 16px;

}

.activet{

color:#00ba6b;

padding-bottom: .3rem;

border-bottom: 2px solid #00ba6b;

}

.swiper_con{

width:100%;

margin-bottom:40px;

position:relative;

}

.choosegrand{

position:absolute;

top:-3;

right:0;

}

.show{

display:block;

}

.none{

display:none;

}

总结

以上所述是小编给大家介绍的vue中选项卡点击切换且能滑动切换功能的实现代码,希望对大家有所帮助

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

GitHub 加速计划 / vu / vue
109
18
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:4 个月前 )
9e887079 [skip ci] 1 年前
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 1 年前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐