@netang/quasar 0.0.93 → 0.0.94

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.
@@ -193,6 +193,7 @@ import $n_isValidString from '@netang/utils/isValidString'
193
193
  import $n_numberDeep from '@netang/utils/numberDeep'
194
194
  import $n_sleep from '@netang/utils/sleep'
195
195
  import $n_http from '@netang/utils/http'
196
+ import $n_runAsync from '@netang/utils/runAsync'
196
197
 
197
198
  import $n_$power from '../../utils/$power'
198
199
  import $n_$table from '../../utils/$table'
@@ -296,6 +297,8 @@ export default {
296
297
  type: [ Number, String ],
297
298
  default: 500
298
299
  },
300
+ // 自定义请求方法
301
+ onRequest: Function,
299
302
  },
300
303
 
301
304
  /**
@@ -743,8 +746,8 @@ export default {
743
746
  */
744
747
  async function onRequestSelected(value) {
745
748
 
746
- // 请求数据
747
- const { status, data } = await $n_http({
749
+ // 请求参数
750
+ const options = {
748
751
  url: props.url ?? $table.routePath,
749
752
  data: Object.assign(
750
753
  // 获取表格请求数据
@@ -771,7 +774,19 @@ export default {
771
774
  },
772
775
  }
773
776
  ),
774
- })
777
+ }
778
+
779
+ // 请求数据
780
+ const { status, data } = $n_isFunction(props.onRequest) ?
781
+ // 如果有自定义请求方法
782
+ await $n_runAsync(props.onRequest)({
783
+ options,
784
+ props,
785
+ // 是否在对话框中
786
+ inDialog: showDialog.value,
787
+ }) :
788
+ // 否则请求数据
789
+ await $n_http(options)
775
790
 
776
791
  return status && $n_isValidArray($n_get(data, 'rows')) ? data.rows : []
777
792
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"