Pārlūkot izejas kodu

fix file input style problem

wangweimin 5 gadi atpakaļ
vecāks
revīzija
5baa7009c2
2 mainītis faili ar 7 papildinājumiem un 7 dzēšanām
  1. 1 1
      pywebio/html/index.html
  2. 6 6
      pywebio/html/js/form.js

+ 1 - 1
pywebio/html/index.html

@@ -1,4 +1,4 @@
-<html>
+<!doctype html>
 <head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

+ 6 - 6
pywebio/html/js/form.js

@@ -776,14 +776,14 @@
 
     const file_input_tpl = `
 <div class="form-group">
-    <label for="customFile">{{label}}</label>
+    <label for="{{id_name}}">{{label}}</label>
     <div class="custom-file">
-        <input type="file" class="custom-file-input" id="{{name}}" aria-describedby="{{name}}_help">
-        <label class="custom-file-label" for="{{name}}">{{placeholder}}</label>
+        <input type="file" name="{{name}}" class="custom-file-input" id="{{id_name}}" aria-describedby="{{id_name}}_help">
+        <label class="custom-file-label" for="{{id_name}}">{{placeholder}}</label>
+        <div class="invalid-feedback">{{invalid_feedback}}</div>  <!-- input 添加 is-invalid 类 -->
+        <div class="valid-feedback">{{valid_feedback}}</div> <!-- input 添加 is-valid 类 -->
+        <small id="{{id_name}}_help"  class="form-text text-muted">{{help_text}}</small>
     </div>
-    <div class="invalid-feedback">{{invalid_feedback}}</div>  <!-- input 添加 is-invalid 类 -->
-    <div class="valid-feedback">{{valid_feedback}}</div> <!-- input 添加 is-valid 类 -->
-    <small id="{{name}}_help"  class="form-text text-muted">{{help_text}}</small>
 </div>`;
 
     FileInputController.prototype.create_element = function () {