修复下拉滚动样式问题
This commit is contained in:
		
							parent
							
								
									d9be71e259
								
							
						
					
					
						commit
						66d15edcba
					
				
							
								
								
									
										2
									
								
								dist/static/2.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/static/2.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/xm-select.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/xm-select.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -8,8 +8,8 @@
 | 
				
			|||||||
xmSelect.render({
 | 
					xmSelect.render({
 | 
				
			||||||
	//...
 | 
						//...
 | 
				
			||||||
	filterable: true,
 | 
						filterable: true,
 | 
				
			||||||
	create: function(val){
 | 
						create: function(val, arr){
 | 
				
			||||||
		//返回一个创建成功的对象, val是搜索的数据
 | 
							//返回一个创建成功的对象, val是搜索的数据, arr是搜索后的当前页面数据
 | 
				
			||||||
		return {
 | 
							return {
 | 
				
			||||||
			name: '创建-' + val,
 | 
								name: '创建-' + val,
 | 
				
			||||||
			value: val
 | 
								value: val
 | 
				
			||||||
@ -26,11 +26,13 @@ xmSelect.render({
 | 
				
			|||||||
var demo1 = xmSelect.render({
 | 
					var demo1 = xmSelect.render({
 | 
				
			||||||
	el: '#demo1', 
 | 
						el: '#demo1', 
 | 
				
			||||||
	filterable: true,
 | 
						filterable: true,
 | 
				
			||||||
	create: function(val){
 | 
						create: function(val, arr){
 | 
				
			||||||
 | 
							if(arr.length === 0){
 | 
				
			||||||
			return {
 | 
								return {
 | 
				
			||||||
				name: '创建-' + val,
 | 
									name: '创建-' + val,
 | 
				
			||||||
				value: val
 | 
									value: val
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	data: [
 | 
						data: [
 | 
				
			||||||
		{name: '张三', value: 1, selected: true},
 | 
							{name: '张三', value: 1, selected: true},
 | 
				
			||||||
@ -55,11 +57,13 @@ var demo1 = xmSelect.render({
 | 
				
			|||||||
	radio: true,
 | 
						radio: true,
 | 
				
			||||||
	clickClose: true,
 | 
						clickClose: true,
 | 
				
			||||||
	filterable: true,
 | 
						filterable: true,
 | 
				
			||||||
	create: function(val){
 | 
						create: function(val, arr){
 | 
				
			||||||
 | 
							if(arr.length === 0){
 | 
				
			||||||
			return {
 | 
								return {
 | 
				
			||||||
				name: '创建-' + val,
 | 
									name: '创建-' + val,
 | 
				
			||||||
				value: val
 | 
									value: val
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	model: {
 | 
						model: {
 | 
				
			||||||
		icon: 'hidden',
 | 
							icon: 'hidden',
 | 
				
			||||||
 | 
				
			|||||||
@ -7,11 +7,8 @@
 | 
				
			|||||||
<script>
 | 
					<script>
 | 
				
			||||||
var demo1 = xmSelect.render({
 | 
					var demo1 = xmSelect.render({
 | 
				
			||||||
	el: '#demo1', 
 | 
						el: '#demo1', 
 | 
				
			||||||
	model: {
 | 
					 | 
				
			||||||
		type: 'relative',
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	filterable: true,
 | 
						filterable: true,
 | 
				
			||||||
	tree: {
 | 
						cascader: {
 | 
				
			||||||
		show: true,
 | 
							show: true,
 | 
				
			||||||
		showFolderIcon: true,
 | 
							showFolderIcon: true,
 | 
				
			||||||
		showLine: true,
 | 
							showLine: true,
 | 
				
			||||||
 | 
				
			|||||||
@ -79,9 +79,6 @@
 | 
				
			|||||||
{name: '自定义', children: [...], click: function(item){
 | 
					{name: '自定义', children: [...], click: function(item){
 | 
				
			||||||
	alert('自定义的, 想干嘛干嘛');
 | 
						alert('自定义的, 想干嘛干嘛');
 | 
				
			||||||
}},
 | 
					}},
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -150,7 +147,6 @@ model: {
 | 
				
			|||||||
> 自定义方式
 | 
					> 自定义方式
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					 | 
				
			||||||
list: [ "ALL", "CLEAR", 
 | 
					list: [ "ALL", "CLEAR", 
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		//显示图标, 可以是layui内置的图标, 也可以是自己引入的图标
 | 
							//显示图标, 可以是layui内置的图标, 也可以是自己引入的图标
 | 
				
			||||||
@ -165,8 +161,6 @@ list: [ "ALL", "CLEAR",
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	} 
 | 
						} 
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### tree
 | 
					### tree
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,7 @@ import Label from '../label';
 | 
				
			|||||||
import General from '../plugin/general';
 | 
					import General from '../plugin/general';
 | 
				
			||||||
import Custom from '../plugin/custom';
 | 
					import Custom from '../plugin/custom';
 | 
				
			||||||
import Tree from '../plugin/tree';
 | 
					import Tree from '../plugin/tree';
 | 
				
			||||||
 | 
					import Cascader from '../plugin/cascader';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 框架渲染类, 渲染基础的外边框 + 属性变化监听
 | 
					 * 框架渲染类, 渲染基础的外边框 + 属性变化监听
 | 
				
			||||||
@ -378,7 +379,7 @@ class Framework extends Component{
 | 
				
			|||||||
		const bodyProps = {  ...config, data, dataObj, flatData, sels, ck: this.itemClick.bind(this), show, onReset: this.onReset.bind(this) }
 | 
							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 (
 | 
							return (
 | 
				
			||||||
			<xm-select { ...xmSelectProps } >
 | 
								<xm-select { ...xmSelectProps } >
 | 
				
			||||||
@ -386,7 +387,7 @@ class Framework extends Component{
 | 
				
			|||||||
				<i class={ show ? 'xm-icon xm-icon-expand' : 'xm-icon' } />
 | 
									<i class={ show ? 'xm-icon xm-icon-expand' : 'xm-icon' } />
 | 
				
			||||||
				{ sels.length === 0 && <div class="xm-tips">{ config.tips }</div> }
 | 
									{ sels.length === 0 && <div class="xm-tips">{ config.tips }</div> }
 | 
				
			||||||
				<Label { ...labelProps } />
 | 
									<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 }
 | 
										{ Body }
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
				{ disabled && <div class="xm-select-disabled"></div> }
 | 
									{ disabled && <div class="xm-select-disabled"></div> }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										40
									
								
								src/components/plugin/cascader.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/components/plugin/cascader.js
									
									
									
									
									
										Normal 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;
 | 
				
			||||||
@ -102,6 +102,11 @@ export default function (lan = 'zn') {
 | 
				
			|||||||
			//懒加载回调
 | 
								//懒加载回调
 | 
				
			||||||
			load: null,
 | 
								load: null,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							//级联结构
 | 
				
			||||||
 | 
							cascader: {
 | 
				
			||||||
 | 
								//是否展示级联
 | 
				
			||||||
 | 
								show: false,
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		//自定义属性名称
 | 
							//自定义属性名称
 | 
				
			||||||
		prop: {
 | 
							prop: {
 | 
				
			||||||
			name: 'name',
 | 
								name: 'name',
 | 
				
			||||||
 | 
				
			|||||||
@ -180,7 +180,8 @@ xm-select{
 | 
				
			|||||||
		animation-fill-mode: both;
 | 
							animation-fill-mode: both;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		.scroll-body{
 | 
							.scroll-body{
 | 
				
			||||||
			overflow: hidden auto;
 | 
								overflow-x: hidden;
 | 
				
			||||||
 | 
								overflow-y: auto;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			.scrollBorder() {
 | 
								.scrollBorder() {
 | 
				
			||||||
				-webkit-border-radius: 2em;
 | 
									-webkit-border-radius: 2em;
 | 
				
			||||||
@ -426,6 +427,24 @@ xm-select{
 | 
				
			|||||||
			width: 0 !important;
 | 
								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{
 | 
						.xm-input{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user