0

Bootstrapを使用してWebサイトのスタイルを設定しています。index.jadeに次のスニペットがあります。

form.form-inline.pull-right(action='http://localhost:1337/authenticated', method='POST')
  input.input-small(type='text', placeholder='Email', name='emailInput') 
  input.input-small(type='password', placeholder='Password', name='passwordInput')
  label.checkbox
    input(type='checkbox') Remember me
  button.btn(type='submit') Sign in

にレンダリングします

<form action="http://localhost:1337/authenticated" method="POST"
  class="form-inline pull-right">
  <input type="text" placeholder="Email" name="emailInput"
    class="input-small"><input type="password"
    placeholder="Password" name="passwordInput" class="input-small"><label
    class="checkbox"><input type="checkbox"></label>
  <button type="submit" class="btn">Sign in</button>
</form>

しかし、次のようにレンダリングする必要があります(インデントではなくタグに注意してください) 編集:実際には同じ意図が必要であり、「Rememberme」が表示されます

<form class="form-inline pull-right" action="http://localhost:1337/authenticated" method="POST">
  <input type="text" class="input-small" placeholder="Email" name="emailInput">
  <input type="password" class="input-small" placeholder="Password" name="passwordInput">
  <label class="checkbox">
    <input type="checkbox"> Remember me
  </label>
  <button type="submit" class="btn">Sign in</button>
</form>

どうすれば修正できますか?Jadeは「label」要素を認識しませんか? 編集:「label」要素を忘れてください、これは正しいです。

4

1 に答える 1

5

「RememberMe」というテキストは、label要素の子である必要があります。

label.checkbox
  input(type='checkbox')
  | Remember Me

あなたの例では、入力要素の子として「Remember Me」がありますが、これは無効であり、レンダリングされません。https://github.com/visionmedia/jade#tag-textを参照してください。

于 2012-06-18T21:16:26.807 に答える