lxui-uni 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env ADDED
@@ -0,0 +1 @@
1
+ NPM_TOKEN=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
package/README.md CHANGED
@@ -8,4 +8,7 @@ npm install lxui-uni -S
8
8
 
9
9
  ### 文档地址:
10
10
 
11
- https://lalalalaxx.github.io/lxui-uni/
11
+ https://blog.csdn.net/qq_51091386/article/details/138125947
12
+ ### 2025年11月04日 更新内容
13
+
14
+ 1. 优化组件lx-operate-bottom显示层级问题。
@@ -13,14 +13,15 @@
13
13
  * @version: V1.0.1
14
14
  */
15
15
  import { LoadData } from '../../libs/hooks/useListLoadClass'
16
- import { debounce } from '../../libs/util'
17
16
  import { toRefs, ref } from 'vue';
18
17
  import lxListState from '../lx-list-state/lx-list-state.vue'
19
18
  interface listPropsInt {
20
19
  api: Function
21
20
  afterLoadData?: Function
22
21
  options?: any
23
- listType?: 'default' | 'scrollView'
22
+ listType?: 'default' | 'scrollView',
23
+ // 列表数据字段
24
+ listDataField?: string
24
25
  }
25
26
 
26
27
  // 接收传值
@@ -29,23 +30,18 @@ const props = withDefaults(defineProps<listPropsInt>(), {
29
30
  api: () => ({}),
30
31
  // eslint-disable-next-line @typescript-eslint/no-empty-function
31
32
  options: {},
32
- listType: 'default'
33
+ listType: 'default',
34
+ listDataField: 'items'
33
35
  })
34
36
  let { options, api, afterLoadData } = toRefs(props)
35
- // console.log('props', props.options, options.value)
36
37
 
37
38
  // 分页相关
38
39
  let { list, isLoading, isEmpty, isNoData, setParams, LoadMore } = LoadData({
39
40
  api: api.value,
40
41
  afterLoadData: afterLoadData?.value,
41
- options: options.value
42
+ options: options.value,
43
+ listDataField: props.listDataField
42
44
  })
43
- // 搜索相关
44
- // const inputTxt = ref('')
45
- // const inputChange = debounce(() => {
46
- // console.log('input change')
47
- // setParams({ search: inputTxt.value })
48
- // })
49
45
 
50
46
  // 用于父组件设置额外的参数(选项卡切换的时候使用)--> isClear true 清空列表需测试
51
47
  const setListParams = (obj: any, isClear = true) => {
@@ -53,9 +49,7 @@ const setListParams = (obj: any, isClear = true) => {
53
49
  search?: string
54
50
  [key: string]: any
55
51
  }>({})
56
- // if (props.isNeedSearch) {
57
- // param.value.search = inputTxt.value
58
- // }
52
+
59
53
  param.value = { ...obj }
60
54
  setParams({ ...param.value }, isClear)
61
55
  }
@@ -77,6 +77,7 @@ const cancelClick = () => emit('cancel')
77
77
  padding-right: 36rpx;
78
78
  padding-top: 10rpx;
79
79
  // box-sizing: border-box;
80
+ z-index: 99;
80
81
  .bottom_left_box {
81
82
  // max-width: 70%;
82
83
  // 普通文本
@@ -35,14 +35,18 @@ const emit = defineEmits(['submit'])
35
35
  padding: 0 28rpx;
36
36
  /* 兼容 iOS < 11.2 */
37
37
  padding-bottom: constant(safe-area-inset-bottom);
38
+ padding-bottom: max(constant(safe-area-inset-bottom, 10rpx), 10rpx);
38
39
  /* 兼容 iOS >= 11.2 */
39
40
  padding-bottom: env(safe-area-inset-bottom);
41
+ padding-bottom: max(env(safe-area-inset-bottom, 10rpx), 10rpx);
40
42
  padding-top: 10rpx;
41
43
  position: fixed;
42
- bottom: 10rpx;
44
+ // bottom: 10rpx;
45
+ bottom: 0;
43
46
  left: 50%;
44
47
  transform: translateX(-50%);
45
48
  width: 100%;
49
+ background-color: #fff;
46
50
 
47
51
  .submit_btn {
48
52
  margin: 0 auto;
@@ -5,108 +5,118 @@
5
5
  * @date: 2023-07-08 08:55:52
6
6
  * @version: V1.0.0
7
7
  */
8
- import { reactive, ref, computed } from "vue"
9
- import { onReachBottom } from "@dcloudio/uni-app"
8
+ import { reactive, ref, computed } from 'vue'
9
+ import { onReachBottom } from '@dcloudio/uni-app'
10
10
 
11
11
  class LoadDataClass {
12
- // 请求参数
13
- static queryParams = reactive({
14
- page: 1,
15
- limit: 10
16
- })
17
- // 列表数据
18
- list = ref<any[]>([])
19
- total = ref(0)
20
- // 前置处理方法
21
- afterLoadData: Function | undefined
22
- // 请求方法
23
- Query: Function
24
- // 加载状态参数
25
- isLoading = ref(false)
26
- // 无更多数据了
27
- isNoData = computed(() => {
28
- if (LoadDataClass.queryParams.page * LoadDataClass.queryParams.limit >= this.total.value) {
29
- return true
30
- } else {
31
- return false
32
- }
33
- })
34
- // 显示暂无数据
35
- isEmpty = computed(() => {
36
- if (this.total.value === 0) {
37
- return true
38
- } else {
39
- return false
40
- }
12
+ // 请求参数
13
+ static queryParams = reactive({
14
+ page: 1,
15
+ limit: 10
16
+ })
17
+ // 列表数据
18
+ list = ref<any[]>([])
19
+ total = ref(0)
20
+ // 列表返回字段
21
+ listDataField = ref<string>('items')
22
+ // 前置处理方法
23
+ afterLoadData: Function | undefined
24
+ // 请求方法
25
+ Query: Function
26
+ // 加载状态参数
27
+ isLoading = ref(false)
28
+ // 无更多数据了
29
+ isNoData = computed(() => {
30
+ if (LoadDataClass.queryParams.page * LoadDataClass.queryParams.limit >= this.total.value) {
31
+ return true
32
+ } else {
33
+ return false
34
+ }
35
+ })
36
+ // 显示暂无数据
37
+ isEmpty = computed(() => {
38
+ if (this.total.value === 0) {
39
+ return true
40
+ } else {
41
+ return false
42
+ }
43
+ })
44
+
45
+ constructor(
46
+ apiFunctions: Function,
47
+ afterLoadData?: Function,
48
+ options: any = {},
49
+ listDataField: string = 'items'
50
+ ) {
51
+ this.queryParamsReset()
52
+ this.Query = apiFunctions
53
+ this.afterLoadData = afterLoadData
54
+ this.listDataField.value = listDataField || 'items'
55
+ // console.log('options', options)
56
+ // 存在额外参数拼接
57
+ this.setParams(options)
58
+ }
59
+ // 加载数据
60
+ LoadData = async () => {
61
+ uni.showLoading({
62
+ title: '加载中...'
41
63
  })
64
+ this.isLoading.value = true
65
+ const res = await this.Query(LoadDataClass.queryParams)
66
+ this.afterLoadData && this.afterLoadData(res)
67
+ this.total.value = res.data.total
68
+ this.list.value = this.list.value.concat(res.data[this.listDataField.value])
42
69
 
43
- constructor(apiFunctions: Function, afterLoadData?: Function, options: any = {}) {
44
- this.queryParamsReset()
45
- this.Query = apiFunctions
46
- this.afterLoadData = afterLoadData
47
- // console.log('options', options)
48
- // 存在额外参数拼接
49
- this.setParams(options)
70
+ uni.hideLoading()
71
+ uni.stopPullDownRefresh()
72
+ this.isLoading.value = false
73
+ }
74
+ /**
75
+ * 添加额外参数刷新
76
+ * @param options: 参数
77
+ * @param isClear: 是否清空数据 false
78
+ */
79
+ setParams = (options: any, isClear: boolean = false) => {
80
+ if (isClear) {
81
+ this.queryParamsReset()
82
+ } else {
83
+ LoadDataClass.queryParams.page = 1
50
84
  }
85
+ this.list.value = []
86
+ console.log('setParams', options);
87
+
88
+ LoadDataClass.queryParams = Object.assign(LoadDataClass.queryParams, options)
51
89
  // 加载数据
52
- LoadData = async () => {
53
- uni.showLoading({
54
- title: '加载中...'
55
- })
56
- this.isLoading.value = true
57
- const res = await this.Query(LoadDataClass.queryParams)
58
- this.afterLoadData && this.afterLoadData(res)
59
- this.total.value = res.data.total
60
- this.list.value = this.list.value.concat(res.data.items)
61
-
62
- uni.hideLoading()
63
- uni.stopPullDownRefresh()
64
- this.isLoading.value = false
65
- }
66
- /**
67
- * 添加额外参数刷新
68
- * @param options: 参数
69
- * @param isClear: 是否清空数据 false
70
- */
71
- setParams = (options: any, isClear: boolean = false) => {
72
- if (isClear) {
73
- this.queryParamsReset()
74
- } else {
75
- LoadDataClass.queryParams.page = 1
76
- }
77
- this.list.value = []
78
- LoadDataClass.queryParams = Object.assign(LoadDataClass.queryParams, options)
79
- // 加载数据
80
- this.LoadData()
81
- }
82
- // 加载更多
83
- LoadMore = () => {
84
- if (this.isNoData.value || this.isLoading.value) return // 无数据或者加载中不进行加载
85
- LoadDataClass.queryParams.page += 1
86
- this.LoadData()
87
- }
88
- // 重置参数
89
- queryParamsReset = () => {
90
- LoadDataClass.queryParams = reactive({
91
- page: 1,
92
- limit: 10
93
- })
94
- }
90
+ this.LoadData()
91
+ }
92
+ // 加载更多
93
+ LoadMore = () => {
94
+ if (this.isNoData.value || this.isLoading.value) return // 无数据或者加载中不进行加载
95
+ LoadDataClass.queryParams.page += 1
96
+ this.LoadData()
97
+ }
98
+ // 重置参数
99
+ queryParamsReset = () => {
100
+ LoadDataClass.queryParams = reactive({
101
+ page: 1,
102
+ limit: 10
103
+ })
104
+ }
95
105
 
96
- /**
97
- * 刷新
98
- * @param isClear: 是否清空数据
99
- */
100
- ReLoad = (isClear: boolean = false) => {
101
- this.isLoading.value = false
102
- this.list.value = []
103
- if (isClear) {
104
- this.queryParamsReset()
105
- } else {
106
- LoadDataClass.queryParams.page = 1
107
- }
108
- this.LoadData()
106
+ /**
107
+ * 刷新
108
+ * @param isClear: 是否清空数据
109
+ */
110
+ ReLoad = (isClear: boolean = false) => {
111
+ this.isLoading.value = false
112
+ this.list.value = []
113
+ if (isClear) {
114
+ this.queryParamsReset()
115
+ } else {
116
+ LoadDataClass.queryParams.page = 1
109
117
  }
118
+ this.LoadData()
119
+ }
110
120
  }
111
121
  /**
112
122
  * 分页加载数据方法
@@ -115,31 +125,36 @@ class LoadDataClass {
115
125
  * @returns
116
126
  */
117
127
  interface LoadDataInt {
118
- api: Function
119
- afterLoadData?: Function
120
- options?: any
121
- isNeedReachBottom?: boolean
128
+ api: Function
129
+ afterLoadData?: Function
130
+ options?: any
131
+ isNeedReachBottom?: boolean
132
+ listDataField?: string
122
133
  }
123
134
 
124
- export function LoadData({ api, afterLoadData, options, isNeedReachBottom = true }: LoadDataInt) {
125
- const data = new LoadDataClass(api, afterLoadData, options)
135
+ export function LoadData({
136
+ api,
137
+ afterLoadData,
138
+ options,
139
+ isNeedReachBottom = true,
140
+ listDataField = 'items'
141
+ }: LoadDataInt) {
142
+ const data = new LoadDataClass(api, afterLoadData, options, listDataField)
126
143
 
127
- // 下拉加载
128
- if (isNeedReachBottom) {
129
- onReachBottom(() => {
130
- console.log('onReachBottom')
131
- data.LoadMore()
132
- })
133
- }
144
+ // 下拉加载
145
+ if (isNeedReachBottom) {
146
+ onReachBottom(() => {
147
+ data.LoadMore()
148
+ })
149
+ }
134
150
 
135
- return {
136
- list: data.list,
137
- isLoading: data.isLoading,
138
- isNoData: data.isNoData,
139
- isEmpty: data.isEmpty,
140
- ReLoad: data.ReLoad,
141
- setParams: data.setParams,
142
- LoadMore: data.LoadMore
143
- }
151
+ return {
152
+ list: data.list,
153
+ isLoading: data.isLoading,
154
+ isNoData: data.isNoData,
155
+ isEmpty: data.isEmpty,
156
+ ReLoad: data.ReLoad,
157
+ setParams: data.setParams,
158
+ LoadMore: data.LoadMore
159
+ }
144
160
  }
145
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lxui-uni",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "快速构建页面",
5
5
  "author": "2399270194@qq.com",
6
6
  "license": "MIT",
package/theme.scss CHANGED
@@ -51,8 +51,6 @@ image {
51
51
  background-color: #f2f2f2;
52
52
  }
53
53
 
54
-
55
-
56
54
  // 弹框公用
57
55
  .dialog_content_lx {
58
56
  .dialog_icon_lx {