Home > Web Front-end > uni-app > body text

How to hide the right scroll bar in uniapp

coldplay.xixi
Release: 2023-01-13 00:44:28
Original
7913 people have browsed it

Uniapp method to hide the right scroll bar: 1. Externally link [base.css] in the style of [app.vue]; 2. Use conditional compilation directly in [app.vue], which can be based on Different platforms control the properties of different tags.

How to hide the right scroll bar in uniapp

The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.

Recommended (free): uni-app development tutorial

How to hide the scroll bar on the right side of uniapp:

1 . Externally link base.css in the style of app.vue. This method is more suitable to control all scroll bars.

<style>
    @import url("./base.css");
</style>
Copy after login

In base.css

::-webkit-scrollbar{
  display: none;
}
Copy after login

2. Directly in app.vue Conditional compilation is used inside, and the attributes of different tags can be controlled according to different platforms

<style>
@import url("./base.css");
/* 解决小程序和app滚动条的问题 */
/* #ifdef MP-WEIXIN || APP-PLUS */
::-webkit-scrollbar{
    display: none;
}
/* #endif */
/* 解决H5 的问题 */
/* #ifdef H5 */
    uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
    /* 隐藏滚动条,但依旧具备可以滚动的功能 */
display: none
    }
/* #endif */
</style>
Copy after login

Related free learning recommendations: Programming Video

The above is the detailed content of How to hide the right scroll bar in uniapp. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template