vue實(shí)現(xiàn)頂部菜單欄
vue實(shí)現(xiàn)頂部菜單欄,同一個(gè)頁(yè)面兩個(gè)菜單按鈕之間的切換
先看展示結(jié)果:點(diǎn)擊第一個(gè)按鈕,顯示內(nèi)容1 點(diǎn)擊第二個(gè)按鈕,展示內(nèi)容2
下面上源碼:注意哦,一定要代碼規(guī)劃,別學(xué)我(⊙o⊙)
<template><div> <div class='tab-content'> <div @click='cur=1' :class='{active:cur==1}'><span>數(shù)據(jù)標(biāo)注</span> </div> <div @click='cur=2' :class='{active:cur==2}'>案件數(shù)</div> </div> <div class='tab'> <div v-show='cur==1'> <div>內(nèi)容1</div> </div> <div v-show='cur==2'> <div>內(nèi)容2</div> </div> </div></div></template><script>export default { data () { return{ cur:1 } },methods:{ }}</script><style scoped>.tab-content .active{ background-color: #194e84 !important; color: #fff; }.tab-content1{ text-align: center; cursor: pointer; width: 150px; height: 30px; border: 1px solid #ccc;}.tab-content2{ margin-top:-30px; text-align: center; cursor: pointer; margin-left:200px; width: 150px; height: 30px; border: 1px solid #ccc;}</style>
分割線-----一個(gè)簡(jiǎn)單的按鈕切換就完成了,思路very簡(jiǎn)單,實(shí)現(xiàn)特別方便,也很好用哦: 是選中菜單時(shí)改變樣式的代碼哦
關(guān)于vue.js組件的教程,請(qǐng)大家點(diǎn)擊專題vue.js組件學(xué)習(xí)教程進(jìn)行學(xué)習(xí)。
更多vue學(xué)習(xí)教程請(qǐng)閱讀專題《vue實(shí)戰(zhàn)教程》
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. idea設(shè)置自動(dòng)導(dǎo)入依賴的方法步驟2. IntelliJ IDEA配置Tomcat服務(wù)器的方法3. ASP.NET MVC把數(shù)據(jù)庫(kù)中枚舉項(xiàng)的數(shù)字轉(zhuǎn)換成文字4. HTML基礎(chǔ)詳解(下)5. vscode運(yùn)行php報(bào)錯(cuò)php?not?found解決辦法6. Python獲取抖音關(guān)注列表封號(hào)賬號(hào)的實(shí)現(xiàn)代碼7. WML的簡(jiǎn)單例子及編輯、測(cè)試方法第1/2頁(yè)8. CSS3實(shí)現(xiàn)動(dòng)態(tài)翻牌效果 仿百度貼吧3D翻牌一次動(dòng)畫(huà)特效9. 解決ASP中http狀態(tài)跳轉(zhuǎn)返回錯(cuò)誤頁(yè)的問(wèn)題10. ASP.NET MVC使用Session會(huì)話保持表單狀態(tài)
