修改定位方式为固定定位,修正定位位置

This commit is contained in:
Theluyuan 2023-08-18 16:54:10 +08:00
parent 05dc278d28
commit e7e9ee2a65
8 changed files with 150692 additions and 41 deletions

View File

@ -1,4 +1,4 @@
const pkg = require('../package.json');
const pkg = require('../package.json');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
@ -7,14 +7,14 @@ const {
CleanWebpackPlugin
} = require('clean-webpack-plugin');
const isProd = process.env.NODE_ENV === 'prod';
const banner =
`@Title: ${pkg.name}
@Version: ${pkg.version}
@Description基于layui的多选解决方案
@Site: https://gitee.com/maplemei/xm-select
@Author: maplemei
const isProd = process.env.NODE_ENV === 'prod';
const banner =
`@Title: ${pkg.name}
@Version: ${pkg.version}
@Description基于layui的多选解决方案
@Site: https://gitee.com/maplemei/xm-select
@Author: maplemei
@LicenseApache License 2.0`;
const webpackConfig = {
@ -90,12 +90,12 @@ const webpackConfig = {
minify: {
collapseWhitespace: true
}
}),
new webpack.BannerPlugin(banner),
}),
new webpack.BannerPlugin(banner),
new VueLoaderPlugin(),
],
optimization: {
minimize: true,//可以自行配置是否压缩
],
optimization: {
minimize: false,//可以自行配置是否压缩
},
devServer: {
host: '0.0.0.0',
@ -112,4 +112,4 @@ if (isProd) {
}
module.exports = webpackConfig;
module.exports = webpackConfig;

13469
dist/static/2.js vendored

File diff suppressed because one or more lines are too long

1126
dist/static/3.js vendored

File diff suppressed because one or more lines are too long

120375
dist/static/docs.js vendored

File diff suppressed because one or more lines are too long

8
dist/xm-select.js vendored

File diff suppressed because one or more lines are too long

9070
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

6638
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -414,7 +414,7 @@ class Framework extends Component{
}else
//聚焦label搜索框
if(type === 'labelSearchBlur'){
this.labelRef.blur(data);
this.labelRef && this.labelRef.blur(data);
}else
//聚焦label搜索框
if(type === 'labelSearch'){
@ -455,7 +455,9 @@ class Framework extends Component{
}
calcPosition(){
if(this.state.show && this.props.model.type === 'fixed'){
if(!this.base || !this.state.show){
return {}
}
let rect = this.base.getBoundingClientRect();
(Date.now() - this.state.time > 10) && this.setState({ time: Date.now() })
return {
@ -464,7 +466,6 @@ class Framework extends Component{
top: rect.y + rect.height + 4,
width: rect.width,
}
}
return {};
}
@ -600,6 +601,7 @@ class Framework extends Component{
}
let rect = this.base.getBoundingClientRect();
let bodyViewHeight;
if(direction === 'auto'){
//用于控制js获取下拉框的高度
this.bodyView.style.display = 'block';
@ -607,7 +609,7 @@ class Framework extends Component{
//获取下拉元素的高度
let bodyViewRect = this.bodyView.getBoundingClientRect();
let bodyViewHeight = bodyViewRect.height;
bodyViewHeight = bodyViewRect.height;
//还原控制效果
this.bodyView.style.display = '';
@ -619,13 +621,12 @@ class Framework extends Component{
let diff = clientHeight - y - rect.height - 20;
direction = diff > bodyViewHeight || y < diff ? 'down' : 'up';
}
if(direction == 'down'){
this.bodyView.style.top = rect.height + 4 + 'px';
this.bodyView.style.top = (rect.height + 4 + rect.y )+ 'px';
this.bodyView.style.bottom = 'auto';
}else{
this.bodyView.style.top = 'auto';
this.bodyView.style.bottom = rect.height + 4 + 'px';
this.bodyView.style.top = (4 +rect.y - bodyViewHeight )+ 'px';
this.bodyView.style.bottom = 'auto';
}
}