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

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

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

瀏覽:115日期: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
相關文章:
主站蜘蛛池模板: 一区二区三区免费高清视频 | 国产成人精品综合 | 免费观看视频成人国产 | 亚洲wuma| 在线观看黄网视频免费播放 | 亚洲激情| 在线视频精品视频 | 麻豆麻豆必出精品入口 | 亚洲精品国产第一区二区小说 | 日本一区二区高清不卡 | 青草国产精品久久久久久 | 国产精品亚洲精品日韩已满 | 国产成人一区二区 | 国产精品免费大片 | 九九99九九视频在线观看 | 国产一区中文字幕在线观看 | 99re最新地址获取精品 | 日韩欧美一区二区在线观看 | 国产精品丝袜 | 在线观看网址入口2020国产 | 91在线精品视频 | 在线观看国产亚洲 | 中文字幕在亚洲第一在线 | 麻豆精品视频入口 | 欧美性性性性性色大片免费的 | 国产免费午夜a无码v视频 | 欧美大片一区 | 国产欧美日韩精品一区二 | 青草香蕉精品视频在线观看 | 色在线免费视频 | 欧美色欧美亚洲另类二区精品 | 亚洲精品在线观看视频 | 欧美 亚洲 国产 精品有声 | 激情自拍网 | 美国一级片免费 | 欧美另类69xxxxx免费 | 天天好比网 | 亚洲福利视频一区二区三区 | 欧美黄色片一级 | 污视频在线观看网址 | 亚洲欧美精品中字久久99 |