修复下拉滚动样式问题

This commit is contained in:
maplemei
2019-12-23 10:24:13 +08:00
parent d9be71e259
commit 66d15edcba
9 changed files with 88 additions and 28 deletions

View File

@@ -6,6 +6,7 @@ import Label from '../label';
import General from '../plugin/general';
import Custom from '../plugin/custom';
import Tree from '../plugin/tree';
import Cascader from '../plugin/cascader';
/**
* 框架渲染类, 渲染基础的外边框 + 属性变化监听
@@ -378,15 +379,15 @@ class Framework extends Component{
const bodyProps = { ...config, data, dataObj, flatData, sels, ck: this.itemClick.bind(this), show, onReset: this.onReset.bind(this) }
//渲染组件
let Body = content ? <Custom { ...bodyProps } /> : tree.show ? <Tree { ...bodyProps } /> : <General { ...bodyProps } />;
let Body = content ? <Custom { ...bodyProps } /> : tree.show ? <Tree { ...bodyProps } /> : config.cascader.show ? <Cascader { ...bodyProps } /> : <General { ...bodyProps } />;
return (
<xm-select { ...xmSelectProps } >
<input class="xm-select-default" lay-verify={ config.layVerify } lay-verType={ config.layVerType } name={ config.name } value={ sels.map(item => item[prop.value]).join(',') }></input>
<i class={ show ? 'xm-icon xm-icon-expand' : 'xm-icon' } />
{ sels.length === 0 && <div class="xm-tips">{ config.tips }</div> }
<Label { ...labelProps } />
<div class={ ['xm-body', config.model.type, show ? '':'dis', ].join(' ') } ref={ ref => this.bodyView = ref}>
<div class={ ['xm-body', Body.type.name, config.model.type, show ? '':'dis', ].join(' ') } ref={ ref => this.bodyView = ref}>
{ Body }
</div>
{ disabled && <div class="xm-select-disabled"></div> }
@@ -444,11 +445,11 @@ class Framework extends Component{
//此时页面又被重新渲染了
componentDidUpdate(){
let { direction, model } = this.props;
if(model.type === 'relative'){
return ;
}
let rect = this.base.getBoundingClientRect();
if(direction === 'auto'){
//用于控制js获取下拉框的高度

View File

@@ -0,0 +1,40 @@
import { h, Component, render } from 'preact'
class Cascader extends Component{
constructor(options){
super(options);
}
//组件将要接收新属性
componentWillReceiveProps(props){
}
//组件将要被挂载
componentWillMount(){
}
render(config, state) {
return (
<div class="xm-cascader">
</div>
)
}
//组件完成挂载
componentDidMount(){
}
//此时页面又被重新渲染了
componentDidUpdate(){
}
}
export default Cascader;

View File

@@ -101,6 +101,11 @@ export default function (lan = 'zn') {
lazy: false,
//懒加载回调
load: null,
},
//级联结构
cascader: {
//是否展示级联
show: false,
},
//自定义属性名称
prop: {

View File

@@ -180,7 +180,8 @@ xm-select{
animation-fill-mode: both;
.scroll-body{
overflow: hidden auto;
overflow-x: hidden;
overflow-y: auto;
.scrollBorder() {
-webkit-border-radius: 2em;
@@ -426,6 +427,24 @@ xm-select{
width: 0 !important;
}
&.Cascader{
border: none;
background-color: transparent;
box-shadow: none;
width: unset;
min-width: unset;
padding: 0;
margin-left: -1px;
.xm-cascader{
border: @border;
border-radius: 2px;
box-shadow: 0 2px 4px rgba(0, 0, 0, .12);
background-color: #FFF;
min-width: 100px;
}
}
}
.xm-input{