紙張輸入中的長錯誤消息溢出屏幕。請參閱下面的jsbin包裝紙輸入錯誤消息
http://jsbin.com/beyigocosi/edit?html,console,output
只需點擊提交,而無需輸入任何值。我試圖用mixin paper-input-error修復它,但沒有取得太大的成功。
代碼:
<!doctype html>
<head>
<meta charset="utf-8">
<base href="http://polymer-magic-server.appspot.com/components/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link href="polymer/polymer.html" rel="import">
<link href="paper-styles/paper-styles.html" rel="import">
<link href="paper-material/paper-material.html" rel="import">
<link href="paper-input/paper-input.html" rel="import">
<link href="paper-button/paper-button.html" rel="import">
<link href="iron-form/iron-form.html" rel="import">
<style>
body {
font-family: sans-serif;
}
</style>
</head>
<body>
<x-example></x-example>
<dom-module id="x-example">
<style>
:host {
display: block;
}
paper-material {
padding: 24px;
}
paper-button {
margin-top: 24px;
background-color: var(--paper-red-400);
color: var(--text-primary-color);
}
</style>
<template>
<form is="iron-form"
id="formTest"
action="/"
method="get"
disable-native-validation-ui>
<paper-material>
<h2>Sample form</h2>
<paper-input
required
type="text"
error-message="This is a reallllllllllllllllllyyyyyyyyyyyy realllllllllllllllllyyyyyyyyyy lllllllllllllllllllllong error message that is going to overflow the screen which neeeeeeeeeeeeeeeeeeeeeeeeeds to be fixed"
label="Enter user name"
name="username">
</paper-input>
<paper-input
text="password"
required
error-message="This is a another realllllllllllllllllllllly reallllllllllyyyyyyyyyyyy lllllllllllllllllllllllong error message that is going to overflow the screen which neeeeeeeeeeeeeeeeeeeeds to be fixed"
label="Enter password"
name="password">
</paper-input>
<paper-button
on-tap="submitForm">SUBMIT</paper-button>
</paper-material>
</form>
</template>
<script>
// only need this when both (1) in the main document and (2) on non-Chrome browsers
addEventListener('WebComponentsReady', function() {
Polymer({
is: "x-example",
properties: {
selected: {
type: String,
value: 'one'
}
},
submitForm: function() {
this.$.formTest.submit();
}
});
});
</script>
</dom-module>
</body>
這不清楚你在這裏問什麼。 – stef
@stef - 如果您點擊「提交」它會顯示溢出窗體的錯誤消息。我正在嘗試在表單中包裝消息。 – Srik