@ecolovo/uniapp-components 2.0.8 → 2.0.9

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.
@@ -44,9 +44,9 @@ declare const useMessageBoxComponent: (messageBoxRef?: Ref<InstanceType<typeof M
44
44
  *
45
45
  * @param isInPage 是否在 Page 中使用,当为 `true` 时,须将返回的 `pageRef` 绑定到 `Page` 组件上
46
46
  */
47
- declare function useMessageBox(isInPage: true): UseMessageBoxReturn & {
47
+ declare function useMessageBox(isInPage: true, pageRef?: Ref<InstanceType<typeof Page> | undefined>): UseMessageBoxReturn & {
48
48
  /** page 组件实例 */
49
- pageRef: Ref<InstanceType<typeof Page>>;
49
+ pageRef: Ref<InstanceType<typeof Page> | undefined>;
50
50
  };
51
51
  declare function useMessageBox(isInPage?: false): UseMessageBoxReturn;
52
52
  export { useMessageBox, useMessageBoxComponent };
@@ -43,7 +43,7 @@ const useMessageBoxComponent = (messageBoxRef) => {
43
43
  showMessageBox,
44
44
  };
45
45
  };
46
- function useMessageBox(isInPage = false) {
46
+ function useMessageBox(isInPage = false, pageRef) {
47
47
  if (!isInPage) {
48
48
  const pageMessageBoxRef = inject('ecolovo/page/messageBoxRef');
49
49
  if (!pageMessageBoxRef) {
@@ -51,18 +51,18 @@ function useMessageBox(isInPage = false) {
51
51
  }
52
52
  return useMessageBoxComponent(pageMessageBoxRef);
53
53
  }
54
- const pageRef = ref();
54
+ const _pageRef = ref(pageRef);
55
55
  const show = async (options) => {
56
- await pageRef.value?.show(options);
56
+ await _pageRef.value?.show(options);
57
57
  };
58
58
  const showConfirm = async (options) => {
59
- await pageRef.value?.showConfirm(options);
59
+ await _pageRef.value?.showConfirm(options);
60
60
  };
61
61
  const showMessageBox = async (options) => {
62
- await pageRef.value?.showMessageBox(options);
62
+ await _pageRef.value?.showMessageBox(options);
63
63
  };
64
64
  return {
65
- pageRef,
65
+ pageRef: _pageRef,
66
66
  show,
67
67
  showConfirm,
68
68
  showMessageBox,
@@ -122,12 +122,18 @@ const useMessageBoxComponent = (
122
122
  *
123
123
  * @param isInPage 是否在 Page 中使用,当为 `true` 时,须将返回的 `pageRef` 绑定到 `Page` 组件上
124
124
  */
125
- function useMessageBox(isInPage: true): UseMessageBoxReturn & {
125
+ function useMessageBox(
126
+ isInPage: true,
127
+ pageRef?: Ref<InstanceType<typeof Page> | undefined>
128
+ ): UseMessageBoxReturn & {
126
129
  /** page 组件实例 */
127
- pageRef: Ref<InstanceType<typeof Page>>;
130
+ pageRef: Ref<InstanceType<typeof Page> | undefined>;
128
131
  };
129
132
  function useMessageBox(isInPage?: false): UseMessageBoxReturn;
130
- function useMessageBox(isInPage: boolean = false) {
133
+ function useMessageBox(
134
+ isInPage: boolean = false,
135
+ pageRef?: Ref<InstanceType<typeof Page> | undefined>
136
+ ) {
131
137
  if (!isInPage) {
132
138
  const pageMessageBoxRef = inject<Ref<InstanceType<typeof MessageBox>>>(
133
139
  'ecolovo/page/messageBoxRef'
@@ -138,22 +144,22 @@ function useMessageBox(isInPage: boolean = false) {
138
144
  return useMessageBoxComponent(pageMessageBoxRef);
139
145
  }
140
146
 
141
- const pageRef = ref<InstanceType<typeof Page>>();
147
+ const _pageRef = ref(pageRef) as Ref<InstanceType<typeof Page> | undefined>;
142
148
 
143
149
  const show: MessageBoxShowCustomFunc = async (options) => {
144
- await pageRef.value?.show(options);
150
+ await _pageRef.value?.show(options);
145
151
  };
146
152
 
147
153
  const showConfirm: MessageBoxShowConfirmFunc = async (options) => {
148
- await pageRef.value?.showConfirm(options);
154
+ await _pageRef.value?.showConfirm(options);
149
155
  };
150
156
 
151
157
  const showMessageBox: MessageBoxShowMessageBoxFunc = async (options) => {
152
- await pageRef.value?.showMessageBox(options);
158
+ await _pageRef.value?.showMessageBox(options);
153
159
  };
154
160
 
155
161
  return {
156
- pageRef,
162
+ pageRef: _pageRef,
157
163
  show,
158
164
  showConfirm,
159
165
  showMessageBox,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecolovo/uniapp-components",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Ecolovo UniApp Vue3 组件库",
5
5
  "keywords": [
6
6
  "components",
@@ -101,6 +101,9 @@ page {
101
101
  }
102
102
 
103
103
  // flex
104
+ .flexible {
105
+ display: flex;
106
+ }
104
107
  .flex-1 {
105
108
  flex: 1;
106
109
  }