@form-create/iview 2.7.1 → 2.7.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.
@@ -30,7 +30,7 @@ export default function getConfig() {
30
30
  submitBtn: {
31
31
  type: 'primary',
32
32
  disabled: false,
33
- innerText: '提交',
33
+ innerText: '',
34
34
  loading: false,
35
35
  show: true,
36
36
  click: undefined,
@@ -39,7 +39,7 @@ export default function getConfig() {
39
39
  type: iviewConfig.resetBtnType,
40
40
  disabled: false,
41
41
  icon: iviewConfig.resetBtnIcon,
42
- innerText: '重置',
42
+ innerText: '',
43
43
  loading: false,
44
44
  show: false,
45
45
  click: undefined,
@@ -146,10 +146,10 @@ export default {
146
146
  const form = this.options.form;
147
147
  const titleSlot = this.getSlot('title');
148
148
  const children = [titleSlot ? titleSlot({
149
- title: ctx.refRule.__$title.value,
149
+ title: ctx.refRule?.__$title.value,
150
150
  rule: ctx.rule,
151
151
  options: this.options
152
- }) : ((ctx.refRule.__$title.value) + (form.labelSuffix || form['label-suffix'] || ''))];
152
+ }) : ((ctx.refRule?.__$title.value) + (form.labelSuffix || form['label-suffix'] || ''))];
153
153
 
154
154
  if (!isFalse(infoProp.show) && (infoProp.info || infoProp.native) && !isFalse(infoProp.icon)) {
155
155
  const prop = {
@@ -167,7 +167,7 @@ export default {
167
167
 
168
168
  const field = 'content';
169
169
  if (infoProp.info && !hasProperty(prop.props, field)) {
170
- prop.props[field] = ctx.refRule.__$info.value;
170
+ prop.props[field] = ctx.refRule?.__$info.value;
171
171
  }
172
172
  children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), [
173
173
  this.$r({
@@ -239,7 +239,7 @@ export default {
239
239
 
240
240
  makeResetBtn() {
241
241
  const resetBtn = {...this.options.resetBtn};
242
- const innerText = resetBtn.innerText;
242
+ const innerText = resetBtn.innerText || this.$handle.api.t('reset') || '重置';
243
243
  delete resetBtn.innerText;
244
244
  delete resetBtn.click;
245
245
  delete resetBtn.col;
@@ -262,7 +262,7 @@ export default {
262
262
  },
263
263
  makeSubmitBtn() {
264
264
  const submitBtn = {...this.options.submitBtn};
265
- const innerText = submitBtn.innerText;
265
+ const innerText = submitBtn.innerText || this.$handle.api.t('submit') || '提交';
266
266
  delete submitBtn.innerText;
267
267
  delete submitBtn.click;
268
268
  delete submitBtn.col;
@@ -15,12 +15,13 @@ const required = {
15
15
  },
16
16
  ...val,
17
17
  };
18
+ const title = rule.__fc__.refRule.__$title.value;
18
19
  if (!validate.message) {
19
- validate.message = rule.__fc__.refRule.__$title.value + (api.getLocale() === 'en' ? ' is required' : '不能为空');
20
+ validate.message = api.t('required', {title}) || (title + (api.getLocale() === 'en' ? ' is required' : '不能为空'));
20
21
  } else {
21
22
  const match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
22
23
  if (match) {
23
- validate.message = api.t(match[1], {title: rule.__fc__.refRule.__$title.value});
24
+ validate.message = api.t(match[1], {title});
24
25
  }
25
26
  }
26
27
  inject.getProp().validate = [validate];