欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Vue實(shí)現(xiàn)簡(jiǎn)單選項(xiàng)卡功能

 更新時(shí)間:2022年03月01日 11:44:41   作者:林飛的夢(mèng)囈  
這篇文章主要為大家詳細(xì)介紹了Vue實(shí)現(xiàn)簡(jiǎn)單選項(xiàng)卡功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Vue實(shí)現(xiàn)簡(jiǎn)單選項(xiàng)卡的具體代碼,供大家參考,具體內(nèi)容如下

vue-tab-demo

App.vue

<template>
? <div id="app">
? ? <Tab/>
? </div>
</template>

<script>
import Tab from './components/Tab'

export default {
? name: 'App',
? components: {
? ? Tab
? }
}
</script>

<style>
? ul, li {
? ? list-style: none;
? }
? .clearfix {
? ? zoom: 1;
? }
? .clearfix:after {
? ? display: block;
? ? content: '';
? ? clear: both;
? }
</style>

先布局,寫(xiě)好樣式
Tab.vue

<template>
<div id="tab">
? <div class="tab-bar clearfix">
? ? <a href="javascript:;">HTML</a>
? ? <a href="javascript:;">CSS</a>
? ? <a href="javascript:;">JavaScript</a>
? ? <a href="javascript:;" class="active">Vue</a>
? </div>
? <div class="tab-con">
? ? <div>HTML</div>
? ? <div>CSS</div>
? ? <div>JavaScript</div>
? ? <div class="light">Vue</div>
? </div>
</div>
</template>

<script>
export default {
? ? data () {
? ? ? return {

? ? ? }
? ? },
? ? methods: {

? ? }
}
</script>

<style scoped>
#tab {
? width: 400px;
? border: 1px solid #ccc;
? margin: 60px auto 0;
}
.tab-bar {
? width: 400px;
? background-color: #ccc;
}
.tab-bar a {
? float: left;
? width: 100px;
? height: 40px;
? line-height: 40px;
? text-align: center;
? text-decoration: none;
? color: #000;
}
.tab-con div {
? text-align: left;
? height: 100px;
? display: none;
}


.tab-bar .active {
? background-color: #0099ff;
}
.tab-con .light {
? display: block;
}
</style>

渲染數(shù)據(jù)后,上面Tab.vue修改后如下:

<template>
? <div id="tab">
? ? <div class="tab-bar clearfix">
? ? ? <a href="javascript:;"
? ? ? ? ?@click="tab(index)"
? ? ? ? ?v-for="(item,index) in items"
? ? ? ? ?:class="{active : index===curId}"
? ? ? >{{item.item}}</a>
? ? </div>
? ? <div class="tab-con">
? ? ? <div
? ? ? ? v-show="index===curId"
? ? ? ? v-for="(content, index) in contents" >{{content.content}}</div>
? ? </div>
? </div>
</template>

<script>
? export default {
? ? data () {
? ? ? return {
? ? ? ? curId: 0,
? ? ? ? items: [
? ? ? ? ? {item: 'HTML'},
? ? ? ? ? {item: 'CSS'},
? ? ? ? ? {item: 'JavaScript'},
? ? ? ? ? {item: 'Vue'},
? ? ? ? ],
? ? ? ? contents: [
? ? ? ? ? {content: 'HTML'},
? ? ? ? ? {content: 'CSS'},
? ? ? ? ? {content: 'JavaScript'},
? ? ? ? ? {content: 'Vue'},
? ? ? ? ]
? ? ? }
? ? },

? ? methods: {
? ? ? tab (index) {
? ? ? ? this.curId = index;
? ? ? }
? ? }
? }
</script>

<style scoped>
? #tab {
? ? width: 400px;
? ? border: 1px solid #ccc;
? ? margin: 60px auto 0;
? }
? .tab-bar {
? ? width: 400px;
? ? background-color: #ccc;
? }
? .tab-bar a {
? ? float: left;
? ? width: 100px;
? ? height: 40px;
? ? line-height: 40px;
? ? text-align: center;
? ? text-decoration: none;
? ? color: #000;
? }
? .tab-bar .active {
? ? background-color: #0099ff;
? }
? .tab-con div {
? ? text-align: left;
? ? height: 100px;
? }

</style>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue項(xiàng)目element-ui級(jí)聯(lián)選擇器el-cascader回顯的問(wèn)題及解決

    vue項(xiàng)目element-ui級(jí)聯(lián)選擇器el-cascader回顯的問(wèn)題及解決

    這篇文章主要介紹了vue項(xiàng)目element-ui級(jí)聯(lián)選擇器el-cascader回顯的問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-07-07
  • vue實(shí)現(xiàn)瀏覽器桌面通知的示例代碼

    vue實(shí)現(xiàn)瀏覽器桌面通知的示例代碼

    本文主要介紹了vue實(shí)現(xiàn)瀏覽器桌面通知的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01
  • vue的axios請(qǐng)求改變content-type為form-data問(wèn)題

    vue的axios請(qǐng)求改變content-type為form-data問(wèn)題

    這篇文章主要介紹了vue的axios請(qǐng)求改變content-type為form-data問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-09-09
  • vue的url請(qǐng)求圖片的問(wèn)題及請(qǐng)求失敗解決

    vue的url請(qǐng)求圖片的問(wèn)題及請(qǐng)求失敗解決

    這篇文章主要介紹了vue的url請(qǐng)求圖片的問(wèn)題及請(qǐng)求失敗解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-09-09
  • vue props傳值失敗 輸出undefined的解決方法

    vue props傳值失敗 輸出undefined的解決方法

    今天小編就為大家分享一篇vue props傳值失敗 輸出undefined的解決方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-09-09
  • Vue3和Vue2的slot-scope插槽用法解讀

    Vue3和Vue2的slot-scope插槽用法解讀

    這篇文章主要介紹了Vue3和Vue2的slot-scope插槽用法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-10-10
  • uniapp項(xiàng)目國(guó)際化標(biāo)準(zhǔn)的配置與實(shí)現(xiàn)

    uniapp項(xiàng)目國(guó)際化標(biāo)準(zhǔn)的配置與實(shí)現(xiàn)

    UniApp是一種基于Vue.js的跨平臺(tái)開(kāi)發(fā)框架,可以快速地開(kāi)發(fā)同時(shí)運(yùn)行在多個(gè)平臺(tái)的應(yīng)用程序,這篇文章主要介紹了uniapp項(xiàng)目國(guó)際化標(biāo)準(zhǔn)的配置與實(shí)現(xiàn),需要的朋友可以參考下
    2023-11-11
  • Vue中tab欄切換的簡(jiǎn)單實(shí)現(xiàn)

    Vue中tab欄切換的簡(jiǎn)單實(shí)現(xiàn)

    本文主要介紹了Vue中tab欄切換的簡(jiǎn)單實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2022-07-07
  • Vue ECharts餅圖實(shí)現(xiàn)方法詳解

    Vue ECharts餅圖實(shí)現(xiàn)方法詳解

    這篇文章主要介紹了在vue.js中,使用echarts組件,創(chuàng)建一個(gè)餅圖,并且獲取餅圖的數(shù)據(jù)和屬性,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧
    2022-12-12
  • Vue Router動(dòng)態(tài)路由使用方法總結(jié)

    Vue Router動(dòng)態(tài)路由使用方法總結(jié)

    這篇文章主要介紹了Vue Router動(dòng)態(tài)路由使用方法總結(jié),需要的朋友可以參考下
    2023-10-10

最新評(píng)論