在纸张输入中设置占位符值(Polymer 1.0)

时间:2017-01-23 08:32:09

标签: polymer

我正在使用Polymer 1.0进行项目。我有<paper-input>,我想设置占位符值。

我尝试设置value

<paper-input value="default value"></paper-input>

但它并没有改变占位符。我也试过label

<paper-input label="default value"></paper-input>

但这也不会改变占位符。如何设置占位符?

1 个答案:

答案 0 :(得分:1)

像这样使用<paper-input>.placeholder

<paper-input placeholder="Enter a number"></paper-input>

&#13;
&#13;
<head>
  <base href="https://polygit.org/polymer+1.7.1/components/">
  <script src="webcomponentsjs/webcomponents-lite.min.js"></script>
  <link rel="import" href="polymer/polymer.html">
  <link rel="import" href="paper-input/paper-input.html">
</head>
<body>
  <paper-input placeholder="Enter a number"></paper-input>
</body>
&#13;
&#13;
&#13;

codepen