亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

Vue實現固定底部組件的示例

瀏覽:86日期:2023-02-08 09:32:42
目錄【實現效果】【實現方式】【實現效果】

Vue實現固定底部組件的示例

【實現方式】

<template> <div id='app'> <div class='main'> <img alt='Vue logo' src='http://www.aoyou183.cn/bcjs/assets/logo.png'> <HelloWorld msg='Welcome to Your Vue.js App'/> <img alt='Vue logo' src='http://www.aoyou183.cn/bcjs/assets/logo.png'> </div> <div class='footer'>這是固定在底部的按鈕</div> </div></template><script>import HelloWorld from ’./components/HelloWorld.vue’export default { name: ’App’, components: { HelloWorld }}</script><style>:root{ --footer-height: 50px;}body { padding: 0; margin: 0;}#app { font-family: Avenir, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; margin-top: 60px;}.main{ padding-bottom: var(--footer-height); overflow-y: auto;}.footer{ position: fixed; bottom: 0; width: 100%; line-height: var(--footer-height); background: #42b983; color: #fff;}</style>

【增加需求】增加一個A邏輯,當滿足A邏輯的時候,底部按鈕就不展示,其他情況則展示。新增一個Bool值(isShow)來判斷是否顯示底部按鈕,具體代碼如下:

<template> <div id='app'> <div class='main'> <img alt='Vue logo' src='http://www.aoyou183.cn/bcjs/assets/logo.png'> <HelloWorld msg='Welcome to Your Vue.js App'/> <img alt='Vue logo' src='http://www.aoyou183.cn/bcjs/assets/logo.png'> </div> <div v-if=’isShow’> <div class='footer-content'>這是固定在底部的按鈕</div> </div> </div></template><script>import HelloWorld from ’./components/HelloWorld.vue’export default { name: ’App’, components: { HelloWorld }, data() { return { isShow: true } },}</script><style>:root{ --footer-height: 50px;}body { padding: 0; margin: 0;}#app { font-family: Avenir, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; margin-top: 60px;}.main { overflow-y: auto;}.footer { height: var(--footer-height);}.footer-content { position: fixed; bottom: 0; width: 100%; line-height: var(--footer-height); background: #42b983; color: #fff;}</style>

到此這篇關于Vue實現固定底部組件的示例的文章就介紹到這了,更多相關Vue 固定底部內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Vue
相關文章:
主站蜘蛛池模板: 欧美xxxx新一区二区三区 | 欧美精品久久久久久久影视 | 国产黄色录像 | 国产午夜精品不卡视频 | 国产一区二区三区精品久久呦 | 韩国黄色网页 | 国产真实伦偷精品 | 久爱www免费人成福利播放 | 久久亚洲黄色 | 青草国产精品久久久久久 | 香蕉97碰碰视频免费 | 综合伊人久久在一二三区 | 国产精品网站在线观看 | 精品成人免费自拍视频 | 黄 色 片 在 线 看 | 日本aaaaa级毛片 | 轻轻啪在线视频播放 | 免费看污污网站 | 亚洲精品天堂一区二区三区 | 免费能直接在线观看黄的视频 | 黄色福利片 | 影音先锋ady69色资源网站 | 亚洲高清国产一区二区三区 | jizz中国zz女人18| 国产 网红 喷水 播放 | 久久综合图区亚洲综合图区 | 国产日韩在线观看视频 | 最新福利小视频在线播放 | 黄网站免费在线观看 | 日本一级爽毛片在线看 | 亚洲国产第一区二区三区 | 国产精品视频久久久久 | 亚洲精品综合在线 | 婷婷在线网站 | 在线 丝袜 欧美 日韩 制服 | 成人午夜激情 | 久久综合久久综合久久综合 | 国产在线观看麻豆91精品免费 | 96精品专区国产在线观看高清 | 欧美日韩视频在线一区二区 | 国产午夜毛片一区二区三区 |