feat(scrollbar): max-height

This commit is contained in:
07akioni 2019-08-07 14:57:34 +08:00
parent 64f23686b2
commit 349f8b5450
4 changed files with 12 additions and 6 deletions

View File

@ -16,7 +16,7 @@
</n-scrollbar> </n-scrollbar>
</div> </div>
<div style="width: 400px; height: 300px;"> <div style="width: 400px; height: 300px;">
<n-scrollbar> <n-scrollbar :max-height="200">
<div style="background: linear-gradient(red, blue); width: 400px; height: 500px;"> <div style="background: linear-gradient(red, blue); width: 400px; height: 500px;">
666 666
</div> </div>

View File

@ -135,10 +135,6 @@ export default {
name: 'Select', name: 'Select',
path: '/n-select' path: '/n-select'
}, },
{
name: 'Cascader',
path: '/n-cascader'
},
{ {
name: 'MultipleLabels', name: 'MultipleLabels',
path: '/n-MultipleLabels' path: '/n-MultipleLabels'

View File

@ -1,6 +1,6 @@
{ {
"name": "naive-ui", "name": "naive-ui",
"version": "0.2.78", "version": "0.2.79",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1,6 +1,9 @@
<template> <template>
<div <div
class="n-scrollbar" class="n-scrollbar"
:style="maxHeight === null ? {} : {
maxHeight: maxHeight + 'px'
}"
@mouseenter="enterScrollWrapper" @mouseenter="enterScrollWrapper"
@mouseleave="leaveScrollWrapper" @mouseleave="leaveScrollWrapper"
@dragstart.capture="handleDragStart" @dragstart.capture="handleDragStart"
@ -8,6 +11,9 @@
<div <div
ref="scrollContainer" ref="scrollContainer"
class="n-scrollbar-container" class="n-scrollbar-container"
:style="maxHeight === null ? {} : {
maxHeight: maxHeight + 'px'
}"
@scroll="handleScroll" @scroll="handleScroll"
> >
<div <div
@ -71,6 +77,10 @@ export default {
duration: { duration: {
type: Number, type: Number,
default: 0 default: 0
},
maxHeight: {
type: Number,
default: null
} }
}, },
data () { data () {