Просмотр исходного кода

fix: edit channel weight and priority

CalciumIon 1 год назад
Родитель
Сommit
cf8b30edfa
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      web/src/pages/Channel/EditChannel.js

+ 12 - 2
web/src/pages/Channel/EditChannel.js

@@ -964,7 +964,12 @@ const EditChannel = (props) => {
             name="priority"
             placeholder={'渠道优先级'}
             onChange={(value) => {
-              handleInputChange('priority', parseInt(value));
+              const number = parseInt(value);
+              if (isNaN(number)) {
+                handleInputChange('priority', value);
+              } else {
+                handleInputChange('priority', number);
+              }
             }}
             value={inputs.priority}
             autoComplete="new-password"
@@ -979,7 +984,12 @@ const EditChannel = (props) => {
             name="weight"
             placeholder={'渠道权重'}
             onChange={(value) => {
-              handleInputChange('weight', parseInt(value));
+              const number = parseInt(value);
+              if (isNaN(number)) {
+                handleInputChange('weight', value);
+              } else {
+                handleInputChange('weight', number);
+              }
             }}
             value={inputs.weight}
             autoComplete="new-password"