GithubHelp home page GithubHelp logo

flex-scroll's Introduction

@growui/flex-scroll

flex 布局中项目的自适应滚动组件。

安装

yarn add @growui/flex-scroll (npm i @growui/flex-scroll)

使用

VScroll.vue

<template>
    <div class="v-scroll-view">
        <div class="header">VScroll</div>
        <div class="content">
            <flex-scroll>
                <div class="item" v-for="n in 50" :key="n">{{ n }}</div>
            </flex-scroll>
        </div>
    </div>
</template>

<script>
import FlexScroll from "@growui/flex-scroll";

export default {
    name: "VScroll",
    components: {
        FlexScroll,
    },
};
</script>

<style scoped>
.v-scroll-view {
    display: flex;
    flex-direction: column;
    width: 400px;
    height: 100%;
}

.header {
    height: 40px;
    line-height: 40px;
    background: pink;
    text-align: center;
}

.content {
    flex: 1;
}

.item {
    height: 36px;
    line-height: 36px;
    border-bottom: 1px solid #ccc;
    text-align: center;
}
</style>

HScroll.vue

<template>
    <div class="h-scroll-view">
        <div class="header">HScroll</div>
        <div class="content">
            <flex-scroll scroll="x">
                <div class="list">
                    <div class="item" v-for="n in 50" :key="n">{{ n }}</div>
                </div>
            </flex-scroll>
        </div>
    </div>
</template>

<script>
import FlexScroll from "@growui/flex-scroll";

export default {
    name: "HScroll",
    components: {
        FlexScroll,
    },
};
</script>

<style scoped>
.h-scroll-view {
    display: flex;
    flex-direction: row;
    width: 800px;
    height: 100%;
}

.header {
    width: 100px;
    height: 100px;
    line-height: 100px;
    background: pink;
    text-align: center;
}

.content {
    flex: 1;
    overflow: auto;
}

.list {
    display: flex;
    flex-direction: row;
}

.item {
    width: 36px;
    height: 100px;
    line-height: 100px;
    border-right: 1px solid #ccc;
    text-align: center;
    flex-shrink: 0;
}
</style>

flex-scroll's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.