@truenewx/tnxvue3 3.4.0 → 3.4.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.
Files changed (65) hide show
  1. package/package.json +23 -42
  2. package/src/bootstrap-vue/alert/Alert.vue +79 -79
  3. package/src/bootstrap-vue/button/Button.vue +40 -40
  4. package/src/bootstrap-vue/enum-select/EnumSelect.vue +4 -5
  5. package/src/bootstrap-vue/form/Form.vue +320 -320
  6. package/src/bootstrap-vue/form/FormGroup.vue +73 -73
  7. package/src/bootstrap-vue/loading-icon/LoadingIcon.vue +46 -46
  8. package/src/bootstrap-vue/paged/Paged.vue +119 -119
  9. package/src/bootstrap-vue/progress/Progress.vue +58 -58
  10. package/src/bootstrap-vue/query-table/QueryTable.vue +84 -84
  11. package/src/bootstrap-vue/region-cascader/RegionCascader.vue +119 -119
  12. package/src/bootstrap-vue/select/Select.vue +375 -375
  13. package/src/bootstrap-vue/submit-form/SubmitForm.vue +180 -176
  14. package/src/bootstrap-vue/tags-input/TagsInput.vue +64 -64
  15. package/src/bootstrap-vue/tnxbsv.css +107 -107
  16. package/src/bootstrap-vue/tnxbsv.js +109 -92
  17. package/src/bootstrap-vue/upload/Upload.vue +173 -173
  18. package/src/{aj-captcha → element-plus/aj-captcha}/Verify/VerifySlide.vue +9 -9
  19. package/src/element-plus/aj-captcha/api/index.js +11 -0
  20. package/src/{aj-captcha → element-plus/aj-captcha}/utils/ase.js +1 -1
  21. package/src/element-plus/avatar/Avatar.vue +8 -9
  22. package/src/element-plus/button/Button.vue +2 -2
  23. package/src/element-plus/curd/Curd.vue +20 -23
  24. package/src/element-plus/date-picker/DatePicker.vue +1 -1
  25. package/src/element-plus/detail-form/DetailForm.vue +1 -1
  26. package/src/element-plus/dialog/Dialog.vue +18 -20
  27. package/src/element-plus/drawer/Drawer.vue +10 -9
  28. package/src/element-plus/edit-table/EditTable.vue +3 -3
  29. package/src/element-plus/enum-select/EnumSelect.vue +3 -3
  30. package/src/element-plus/enum-view/EnumView.vue +41 -41
  31. package/src/element-plus/fetch-cascader/FetchCascader.vue +3 -4
  32. package/src/element-plus/fetch-select/FetchSelect.vue +10 -11
  33. package/src/element-plus/fetch-tags/FetchTags.vue +4 -5
  34. package/src/element-plus/fss-upload/FssUpload.vue +18 -18
  35. package/src/element-plus/fss-view/FssView.vue +1 -1
  36. package/src/element-plus/icon/Icon.vue +6 -0
  37. package/src/element-plus/input-dropdown/InputDropdown.vue +74 -74
  38. package/src/element-plus/query-form/QueryForm.vue +1 -1
  39. package/src/element-plus/query-table/QueryTable.vue +22 -26
  40. package/src/element-plus/region-cascader/RegionCascader.vue +4 -5
  41. package/src/element-plus/select/Select.vue +11 -7
  42. package/src/element-plus/steps-nav/StepsNav.vue +3 -4
  43. package/src/element-plus/submit-form/SubmitForm.vue +36 -39
  44. package/src/element-plus/tabs/Tabs.vue +1 -1
  45. package/src/element-plus/tnxel.css +22 -0
  46. package/src/element-plus/tnxel.js +105 -94
  47. package/src/element-plus/toolbar/ToolBarItem.js +15 -15
  48. package/src/element-plus/toolbar/Toolbar.vue +56 -56
  49. package/src/element-plus/transfer/Transfer.vue +8 -9
  50. package/src/element-plus/upload/Upload.vue +24 -24
  51. package/src/tdesign/desktop/tnxtdd.ts +16 -0
  52. package/src/tdesign/foundation/validator.ts +367 -0
  53. package/src/tdesign/mobile/tnxtdm.ts +16 -0
  54. package/src/tdesign/tnxtd.ts +20 -0
  55. package/src/{tnxvue-router.js → tnxvue-router.ts} +66 -48
  56. package/src/tnxvue.ts +248 -0
  57. package/src/types.d.ts +7 -0
  58. package/tsconfig.json +21 -0
  59. package/index.html +0 -12
  60. package/src/aj-captcha/api/index.js +0 -19
  61. package/src/tnxvue-validator.js +0 -365
  62. package/src/tnxvue.js +0 -439
  63. /package/src/{aj-captcha → element-plus/aj-captcha}/Verify/VerifyPoints.vue +0 -0
  64. /package/src/{aj-captcha → element-plus/aj-captcha}/Verify.vue +0 -0
  65. /package/src/{aj-captcha → element-plus/aj-captcha}/utils/util.js +0 -0
@@ -1,173 +1,173 @@
1
- <template>
2
- <div class="tnxbsv-upload">
3
- <BOverlay :show="uploading" spinner-variant="primary" spinner-small>
4
- <BInputGroup>
5
- <BFormInput :value="file?.name" :placeholder="placeholder" tabindex="-1" readonly/>
6
- <template #append>
7
- <div class="input-group-append">
8
- <i class="bi bi-x-circle icon-clear" @click="clear" v-if="empty"/>
9
- <BButton :variant="buttonType" @click="toSelect">{{ buttonText }}</BButton>
10
- </div>
11
- </template>
12
- </BInputGroup>
13
- <BFormFile class="d-none" v-model="file" :accept="uploadOptions.extensions || accept"/>
14
- </BOverlay>
15
- <div class="tnxbsv-upload-error" v-if="errorMessage">{{ errorMessage }}</div>
16
- </div>
17
- </template>
18
-
19
- <script>
20
- import {BOverlay, BInputGroup, BFormInput, BButton, BFormFile} from 'bootstrap-vue-next';
21
-
22
- export default {
23
- name: 'TnxbsvUpload',
24
- components: {BOverlay, BInputGroup, BFormInput, BButton, BFormFile,},
25
- props: {
26
- app: String, // 上传目标应用名称
27
- action: {
28
- type: String,
29
- required: true,
30
- },
31
- accept: [String, Array],
32
- uploadOptions: {
33
- type: Object,
34
- default: () => ({}),
35
- },
36
- placeholder: String,
37
- buttonType: {
38
- type: String,
39
- default: 'light',
40
- },
41
- buttonText: {
42
- type: String,
43
- default: '选择文件',
44
- },
45
- empty: Boolean,
46
- beforeUpload: Function,
47
- onSuccess: Function,
48
- onError: Function,
49
- },
50
- data() {
51
- return {
52
- file: null,
53
- uploading: false,
54
- errorMessage: null,
55
- };
56
- },
57
- computed: {
58
- actionUrl() {
59
- let baseUrl;
60
- if (this.app) {
61
- baseUrl = window.tnx.app.rpc.getBaseUrl(this.app);
62
- }
63
- baseUrl = baseUrl || window.tnx.app.rpc.getDefaultBaseUrl();
64
- return baseUrl + this.action;
65
- },
66
- },
67
- watch: {
68
- file(newFile, oldFile) {
69
- if (newFile) {
70
- if (!newFile.handled) {
71
- this.uploadFile();
72
- }
73
- } else if (!oldFile.handled) {
74
- oldFile.handled = true;
75
- this.file = oldFile;
76
- }
77
- }
78
- },
79
- mounted() {
80
- this.file = null;
81
- this.uploading = false;
82
- this.errorMessage = null;
83
- },
84
- methods: {
85
- toSelect() {
86
- const $ = window.tnx.libs.$;
87
- $('.tnxbsv-upload input[type="file"]').trigger('click')
88
- },
89
- clear() {
90
- this.file.handled = true;
91
- this.$nextTick(() => {
92
- this.file = null;
93
- });
94
- },
95
- uploadFile() {
96
- if (this.file) {
97
- if (this.beforeUpload && this.beforeUpload(this.file) === false) {
98
- return;
99
- }
100
- const formData = new FormData();
101
- formData.append('file', this.file);
102
- this.uploading = true;
103
- this.errorMessage = null;
104
-
105
- window.tnx.app.rpc.request(this.actionUrl, {
106
- method: 'POST',
107
- body: formData,
108
- timeout: 0, // 文件上传不设置超时
109
- app: this.app, // 指定目标应用
110
- success: result => {
111
- if (this.onSuccess) {
112
- this.onSuccess(result);
113
- } else {
114
- console.log('文件上传成功:', result);
115
- }
116
- this.uploading = false;
117
- },
118
- error: error => {
119
- this.uploading = false;
120
- if (this.onError && this.onError(error) === false) {
121
- return;
122
- }
123
- this.errorMessage = error.message;
124
- }
125
- });
126
- }
127
- }
128
- }
129
- }
130
- </script>
131
-
132
- <style>
133
- .tnxbsv-upload input:focus {
134
- outline: none;
135
- box-shadow: none;
136
- border-color: var(--bs-border-color);
137
- }
138
-
139
- .tnxbsv-upload .input-group-append {
140
- position: relative;
141
- }
142
-
143
- .tnxbsv-upload .input-group-append .icon-clear {
144
- position: absolute;
145
- right: calc(100% + 0.75rem);
146
- top: 50%;
147
- transform: translateY(-50%);
148
- cursor: pointer;
149
- z-index: 10;
150
- color: var(--bs-tertiary-color);
151
- }
152
-
153
- .tnxbsv-upload .input-group-append .icon-clear:hover {
154
- color: var(--bs-secondary-color);
155
- }
156
-
157
- .tnxbsv-upload .input-group-append .btn {
158
- border-top-left-radius: 0;
159
- border-bottom-left-radius: 0;
160
- }
161
-
162
- .tnxbsv-upload-error {
163
- margin-top: 0.25rem;
164
- color: var(--bs-danger);
165
- font-size: 87.5%;
166
- }
167
-
168
- .tnxbsv-upload-placeholder {
169
- margin-top: 0.25rem;
170
- color: var(--bs-tertiary-color);
171
- font-size: 87.5%;
172
- }
173
- </style>
1
+ <template>
2
+ <div class="tnxbsv-upload">
3
+ <BOverlay :show="uploading" spinner-variant="primary" spinner-small>
4
+ <BInputGroup>
5
+ <BFormInput :value="file?.name" :placeholder="placeholder" tabindex="-1" readonly/>
6
+ <template #append>
7
+ <div class="input-group-append">
8
+ <i class="bi bi-x-circle icon-clear" @click="clear" v-if="empty"/>
9
+ <BButton :variant="buttonType" @click="toSelect">{{ buttonText }}</BButton>
10
+ </div>
11
+ </template>
12
+ </BInputGroup>
13
+ <BFormFile class="d-none" v-model="file" :accept="uploadOptions.extensions || accept"/>
14
+ </BOverlay>
15
+ <div class="tnxbsv-upload-error" v-if="errorMessage">{{ errorMessage }}</div>
16
+ </div>
17
+ </template>
18
+
19
+ <script>
20
+ import {BOverlay, BInputGroup, BFormInput, BButton, BFormFile} from 'bootstrap-vue-next';
21
+
22
+ export default {
23
+ name: 'TnxbsvUpload',
24
+ components: {BOverlay, BInputGroup, BFormInput, BButton, BFormFile,},
25
+ props: {
26
+ app: String, // 上传目标应用名称
27
+ action: {
28
+ type: String,
29
+ required: true,
30
+ },
31
+ accept: [String, Array],
32
+ uploadOptions: {
33
+ type: Object,
34
+ default: () => ({}),
35
+ },
36
+ placeholder: String,
37
+ buttonType: {
38
+ type: String,
39
+ default: 'light',
40
+ },
41
+ buttonText: {
42
+ type: String,
43
+ default: '选择文件',
44
+ },
45
+ empty: Boolean,
46
+ beforeUpload: Function,
47
+ onSuccess: Function,
48
+ onError: Function,
49
+ },
50
+ data() {
51
+ return {
52
+ file: null,
53
+ uploading: false,
54
+ errorMessage: null,
55
+ };
56
+ },
57
+ computed: {
58
+ actionUrl() {
59
+ let baseUrl;
60
+ if (this.app) {
61
+ baseUrl = window.tnx.app.rpc.getBaseUrl(this.app);
62
+ }
63
+ baseUrl = baseUrl || window.tnx.app.rpc.getDefaultBaseUrl();
64
+ return baseUrl + this.action;
65
+ },
66
+ },
67
+ watch: {
68
+ file(newFile, oldFile) {
69
+ if (newFile) {
70
+ if (!newFile.handled) {
71
+ this.uploadFile();
72
+ }
73
+ } else if (!oldFile.handled) {
74
+ oldFile.handled = true;
75
+ this.file = oldFile;
76
+ }
77
+ }
78
+ },
79
+ mounted() {
80
+ this.file = null;
81
+ this.uploading = false;
82
+ this.errorMessage = null;
83
+ },
84
+ methods: {
85
+ toSelect() {
86
+ const $ = window.tnx.libs.$;
87
+ $('.tnxbsv-upload input[type="file"]').trigger('click')
88
+ },
89
+ clear() {
90
+ this.file.handled = true;
91
+ this.$nextTick(() => {
92
+ this.file = null;
93
+ });
94
+ },
95
+ uploadFile() {
96
+ if (this.file) {
97
+ if (this.beforeUpload && this.beforeUpload(this.file) === false) {
98
+ return;
99
+ }
100
+ const formData = new FormData();
101
+ formData.append('file', this.file);
102
+ this.uploading = true;
103
+ this.errorMessage = null;
104
+
105
+ window.tnx.app.rpc.request(this.actionUrl, {
106
+ method: 'POST',
107
+ body: formData,
108
+ timeout: 0, // 文件上传不设置超时
109
+ app: this.app, // 指定目标应用
110
+ success: result => {
111
+ if (this.onSuccess) {
112
+ this.onSuccess(result);
113
+ } else {
114
+ console.log('文件上传成功:', result);
115
+ }
116
+ this.uploading = false;
117
+ },
118
+ error: error => {
119
+ this.uploading = false;
120
+ if (this.onError && this.onError(error) === false) {
121
+ return;
122
+ }
123
+ this.errorMessage = error.message;
124
+ }
125
+ });
126
+ }
127
+ }
128
+ }
129
+ }
130
+ </script>
131
+
132
+ <style>
133
+ .tnxbsv-upload input:focus {
134
+ outline: none;
135
+ box-shadow: none;
136
+ border-color: var(--bs-border-color);
137
+ }
138
+
139
+ .tnxbsv-upload .input-group-append {
140
+ position: relative;
141
+ }
142
+
143
+ .tnxbsv-upload .input-group-append .icon-clear {
144
+ position: absolute;
145
+ right: calc(100% + 0.75rem);
146
+ top: 50%;
147
+ transform: translateY(-50%);
148
+ cursor: pointer;
149
+ z-index: 10;
150
+ color: var(--bs-tertiary-color);
151
+ }
152
+
153
+ .tnxbsv-upload .input-group-append .icon-clear:hover {
154
+ color: var(--bs-secondary-color);
155
+ }
156
+
157
+ .tnxbsv-upload .input-group-append .btn {
158
+ border-top-left-radius: 0;
159
+ border-bottom-left-radius: 0;
160
+ }
161
+
162
+ .tnxbsv-upload-error {
163
+ margin-top: 0.25rem;
164
+ color: var(--bs-danger);
165
+ font-size: 87.5%;
166
+ }
167
+
168
+ .tnxbsv-upload-placeholder {
169
+ margin-top: 0.25rem;
170
+ color: var(--bs-tertiary-color);
171
+ font-size: 87.5%;
172
+ }
173
+ </style>
@@ -161,33 +161,33 @@ export default {
161
161
  proxy.$parent.$emit('ready', proxy)
162
162
  })
163
163
 
164
- window.removeEventListener("touchmove", function (e) {
164
+ window.removeEventListener("touchmove", (e) => {
165
165
  move(e);
166
166
  });
167
- window.removeEventListener("mousemove", function (e) {
167
+ window.removeEventListener("mousemove", (e) => {
168
168
  move(e);
169
169
  });
170
170
 
171
171
  //鼠标松开
172
- window.removeEventListener("touchend", function () {
172
+ window.removeEventListener("touchend", () => {
173
173
  end();
174
174
  });
175
- window.removeEventListener("mouseup", function () {
175
+ window.removeEventListener("mouseup", () => {
176
176
  end();
177
177
  });
178
178
 
179
- window.addEventListener("touchmove", function (e) {
179
+ window.addEventListener("touchmove", (e) => {
180
180
  move(e);
181
181
  });
182
- window.addEventListener("mousemove", function (e) {
182
+ window.addEventListener("mousemove", (e) => {
183
183
  move(e);
184
184
  });
185
185
 
186
186
  //鼠标松开
187
- window.addEventListener("touchend", function () {
187
+ window.addEventListener("touchend", () => {
188
188
  end();
189
189
  });
190
- window.addEventListener("mouseup", function () {
190
+ window.addEventListener("mouseup", () => {
191
191
  end();
192
192
  });
193
193
  }
@@ -289,7 +289,7 @@ export default {
289
289
  leftBarClass.value = 'border-danger';
290
290
  moveBlockIcon.value = 'icon-close';
291
291
  passFlag.value = false
292
- setTimeout(function () {
292
+ setTimeout(() => {
293
293
  refresh();
294
294
  }, 1000);
295
295
  proxy.$parent.$emit('error', proxy)
@@ -0,0 +1,11 @@
1
+ // 获取验证图片以及token
2
+ export function reqGet(data) {
3
+ return window.tnx.app.rpc.post('/captcha/generate', data);
4
+ }
5
+
6
+ // 滑动或者点选验证
7
+ export function reqCheck(data) {
8
+ return window.tnx.app.rpc.post('/captcha/check', data);
9
+ }
10
+
11
+
@@ -1,4 +1,4 @@
1
- import CryptoES from 'crypto-es';
1
+ import * as CryptoES from 'crypto-es';
2
2
 
3
3
  /**
4
4
  * @word 要加密的内容
@@ -76,13 +76,12 @@ export default {
76
76
  if (this.url && this.url.startsWith(window.tnx.fss.PROTOCOL)) {
77
77
  let rpc = window.tnx.app.rpc;
78
78
  let fssConfig = window.tnx.fss.getClientConfig();
79
- let vm = this;
80
- if (vm.preview) {
79
+ if (this.preview) {
81
80
  rpc.get(fssConfig.contextUrl + '/meta', {
82
- locationUrl: vm.url
83
- }, function (meta) {
84
- vm.src = meta.thumbnailReadUrl;
85
- vm.previewSrcList = [meta.readUrl];
81
+ locationUrl: this.url
82
+ }, (meta) => {
83
+ this.src = meta.thumbnailReadUrl;
84
+ this.previewSrcList = [meta.readUrl];
86
85
  }, {
87
86
  app: fssConfig.appName,
88
87
  error(errors) {
@@ -91,10 +90,10 @@ export default {
91
90
  });
92
91
  } else {
93
92
  rpc.get(fssConfig.contextUrl + '/read/url', {
94
- locationUrl: vm.url,
93
+ locationUrl: this.url,
95
94
  thumbnail: true,
96
- }, function (readUrl) {
97
- vm.src = readUrl;
95
+ }, (readUrl) => {
96
+ this.src = readUrl;
98
97
  }, {
99
98
  app: fssConfig.appName,
100
99
  error(errors) {
@@ -161,7 +161,7 @@ export default {
161
161
  this.finalDisabled = this.disabled || !this.granted;
162
162
  } else if (this.menu && this.path) {
163
163
  let vm = this;
164
- this.menu.loadGrantedItems(function () {
164
+ this.menu.loadGrantedItems(() => {
165
165
  vm.finalDisabled = this.disabled || !vm.menu.isGranted(vm.path);
166
166
  vm.buildDropdownItems();
167
167
  });
@@ -201,7 +201,7 @@ export default {
201
201
  } else if (this.$router && this.click !== true && item.menuItem && item.menuItem.path) {
202
202
  // click属性为true时执行点击动作而不是跳转
203
203
  let vm = this;
204
- this.$router.push(item.path).catch(function () {
204
+ this.$router.push(item.path).catch(() => {
205
205
  // 指定路径无法跳转,则触发点击事件
206
206
  vm.$emit('click', item.path);
207
207
  });
@@ -109,19 +109,18 @@ export default {
109
109
  }
110
110
  },
111
111
  toAdd() {
112
- let vm = this;
113
112
  window.tnx.open(this.page, this.pageProps, {
114
- title: vm.addText + (vm.modelName || ''),
115
- click: function(yes, close) {
113
+ title: this.addText + (this.modelName || ''),
114
+ click: (yes, close) => {
116
115
  if (yes) {
117
116
  if (typeof this.validateForm === 'function') {
118
- this.validateForm(function(model) {
119
- if (vm.add) {
120
- vm.add(model, function() {
121
- vm._onAdded(model, close);
117
+ this.validateForm((model) => {
118
+ if (this.add) {
119
+ this.add(model, () => {
120
+ this._onAdded(model, close);
122
121
  });
123
122
  } else {
124
- vm._onAdded(model, close);
123
+ this._onAdded(model, close);
125
124
  }
126
125
  });
127
126
  return false;
@@ -164,26 +163,25 @@ export default {
164
163
  toUpdate(index) {
165
164
  let model = Object.assign({}, this.list[index]);
166
165
  if (model) {
167
- let vm = this;
168
166
  window.tnx.open(this.page, {
169
167
  modelValue: model
170
168
  }, {
171
- title: vm.updateText + (vm.modelName || ''),
172
- click: function(yes, close) {
169
+ title: this.updateText + (this.modelName || ''),
170
+ click: (yes, close) => {
173
171
  if (yes) {
174
172
  if (typeof this.validateForm === 'function') {
175
- this.validateForm(function(model) {
176
- if (vm.update) {
177
- vm.update(index, model, function() {
178
- vm._onUpdated(index, model, close);
173
+ this.validateForm((model) => {
174
+ if (this.update) {
175
+ this.update(index, model, () => {
176
+ this._onUpdated(index, model, close);
179
177
  });
180
178
  } else {
181
- vm._onUpdated(index, model, close);
179
+ this._onUpdated(index, model, close);
182
180
  }
183
181
  });
184
182
  return false;
185
183
  } else {
186
- vm._onUpdated(index, model, close);
184
+ this._onUpdated(index, model, close);
187
185
  }
188
186
  }
189
187
  }
@@ -199,16 +197,15 @@ export default {
199
197
  close();
200
198
  },
201
199
  toRemove(index) {
202
- let vm = this;
203
200
  let modelName = this.modelName ? ('该' + this.modelName) : '';
204
- window.tnx.confirm('确定要' + this.removeText + modelName + '吗?', function(yes) {
201
+ window.tnx.confirm('确定要' + this.removeText + modelName + '吗?').then((yes) => {
205
202
  if (yes) {
206
- if (vm.remove) {
207
- vm.remove(index, function() {
208
- vm._onRemoved(index);
203
+ if (this.remove) {
204
+ this.remove(index, () => {
205
+ this._onRemoved(index);
209
206
  });
210
207
  } else {
211
- vm._onRemoved(index);
208
+ this._onRemoved(index);
212
209
  }
213
210
  }
214
211
  });
@@ -124,7 +124,7 @@ export default {
124
124
  },
125
125
  mounted() {
126
126
  let vm = this;
127
- this.$watch('model', function () {
127
+ this.$watch('model', () => {
128
128
  vm.emitModelValue();
129
129
  }, {
130
130
  deep: true
@@ -4,7 +4,7 @@
4
4
  <slot></slot>
5
5
  <el-form-item class="w-100 mb-0" :label="vertical ? undefined : '&nbsp;'" v-if="update || back !== false">
6
6
  <el-button :type="theme || 'primary'" @click="toUpdate" v-if="update">{{ updateText }}</el-button>
7
- <el-button type="default" @click="toBack" v-if="back !== false">{{ backText }}</el-button>
7
+ <el-button @click="toBack" v-if="back !== false">{{ backText }}</el-button>
8
8
  </el-form-item>
9
9
  </el-form>
10
10
  </template>
@@ -101,9 +101,8 @@ export default {
101
101
  modelValue(newValue, oldValue) {
102
102
  this.visible = this.modelValue;
103
103
  if (newValue && !oldValue) { // 从隐藏到显示
104
- let vm = this;
105
- this.$nextTick(function () {
106
- vm.locate(true);
104
+ this.$nextTick(() => {
105
+ this.locate(true);
107
106
  });
108
107
  }
109
108
  },
@@ -115,22 +114,21 @@ export default {
115
114
  window.tnx.app.eventBus.once('tnx.error', options => {
116
115
  this.buttonLoadings = [];
117
116
  });
118
- let vm = this;
119
- this.$nextTick(function () {
117
+ this.$nextTick(() => {
120
118
  if (this.visible) {
121
- vm.locate(true);
119
+ this.locate(true);
122
120
  }
123
121
 
124
- if (vm.$refs.content && !vm.$refs.content.close) {
125
- vm.$refs.content.close = function () {
126
- vm.close();
122
+ if (this.$refs.content && !this.$refs.content.close) {
123
+ this.$refs.content.close = () => {
124
+ this.close();
127
125
  }
128
126
  }
129
127
 
130
- if (typeof vm.options.onShown === 'function') {
131
- vm.options.onShown.call(this);
128
+ if (typeof this.options.onShown === 'function') {
129
+ this.options.onShown.call(this);
132
130
  } else {
133
- vm.$emit('shown');
131
+ this.$emit('shown');
134
132
  }
135
133
  });
136
134
  },
@@ -184,18 +182,18 @@ export default {
184
182
  }
185
183
  this.close();
186
184
  },
187
- close(callback) {
188
- const vm = this;
189
- this.beforeClose(function () {
190
- if (typeof callback === 'function') {
191
- vm.options.onClosed = window.tnx.util.function.around(vm.options.onClosed, function (onClosed) {
185
+ close() {
186
+ return new Promise((resolve) => {
187
+ this.beforeClose(() => {
188
+ const originalOnClosed = this.options.onClosed;
189
+ this.options.onClosed = window.tnx.util.function.around(originalOnClosed, function (onClosed) {
192
190
  if (onClosed) {
193
191
  onClosed();
194
192
  }
195
- callback();
193
+ resolve();
196
194
  });
197
- }
198
- vm.visible = false;
195
+ this.visible = false;
196
+ });
199
197
  });
200
198
  },
201
199
  beforeClose(done) {