【Effect】 【Implementation method】<template> <div id="app"> <div class="main"> <img alt="Vue logo" src="./assets/logo.png"> <HelloWorld msg="Welcome to Your Vue.js App"/> <img alt="Vue logo" src="./assets/logo.png"> </div> <div class="footer">This is a button fixed at the bottom</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> [Add requirements] Add an A logic. When the A logic is met, the bottom button will not be displayed, but it will be displayed in other cases. <template> <div id="app"> <div class="main"> <img alt="Vue logo" src="./assets/logo.png"> <HelloWorld msg="Welcome to Your Vue.js App"/> <img alt="Vue logo" src="./assets/logo.png"> </div> <div class="footer" v-if='isShow'> <div class="footer-content">This is a button fixed at the bottom</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> This concludes this article about the example of implementing a fixed bottom component with Vue. For more relevant Vue fixed bottom content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL 5.7.16 ZIP package installation and configuration tutorial
>>: Example method of viewing IP in Linux
This tutorial shares the installation tutorial of...
1. Current date select DATE_SUB(curdate(),INTERVA...
This article mainly introduces the configuration ...
Three useful codes to help visitors remember your...
Preface Hello everyone, I am Liang Xu. At work, w...
Table of contents Preface 1. Use $attrs and $list...
We all know that Jmeter provides native result vi...
This article shares with you the detailed install...
For the beginner's first installation of MySQ...
today select * from table name where to_days(time...
Table of contents 1. The magical extension operat...
Vue plugin reports an error: Vue.js is detected o...
mysql between boundary range The range of between...
The Spring Boot project uses docker containers, j...
<br />How can I remove the scroll bar on the...