springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 14:07:16
200
我在网上找到了这段代码here
@typeparam T
@inherits InputNumber<T>
<input @attributes="AdditionalAttributes"
type="number"
class="@CssClass"
value="@stringValue"
@oninput="OnInput"
@onblur="OnBlur" />
@code {
private string stringValue;
private T lastParsedValue;
protected override void OnParametersSet()
{
// Only overwrite the "stringValue" when the Value is different
if (!Equals(CurrentValue, lastParsedValue))
{
lastParsedValue = CurrentValue;
stringValue = CurrentValueAsString;
}
}
private void OnInput(ChangeEventArgs e)
{
// Update the value
CurrentValueAsString = stringValue = (string)e.Value;
lastParsedValue = CurrentValue;
}
private void OnBlur(FocusEventArgs e)
{
// Overwrite the stringValue property with the parsed value.
// This call Value.ToString(), so the value in the input is well formatted.
// note: Ensure the string value is valid before updating the content
if (!EditContext.GetValidationMessages(FieldIdentifier).Any())
{
stringValue = CurrentValueAsString;
}
}
}
和
@typeparam T
@inherits InputNumber<T>
<input @attributes="AdditionalAttributes"
type="number"
class="@CssClass"
value="@stringValue"
@oninput="OnInput"
@onblur="OnBlur" />
@code {
private string stringValue;
private T lastParsedValue;
protected override void OnParametersSet()
{
// Only overwrite the "stringValue" when the Value is different
if (!Equals(CurrentValue, lastParsedValue))
{
lastParsedValue = CurrentValue;
stringValue = CurrentValueAsString;
}
}
private void OnInput(ChangeEventArgs e)
{
// Update the value
CurrentValueAsString = stringValue = (string)e.Value;
lastParsedValue = CurrentValue;
}
private void OnBlur(FocusEventArgs e)
{
// Overwrite the stringValue property with the parsed value.
// This call Value.ToString(), so the value in the input is well formatted.
// note: Ensure the string value is valid before updating the content
if (!EditContext.GetValidationMessages(FieldIdentifier).Any())
{
stringValue = CurrentValueAsString;
}
}
}
我要停止'e'字符和
还有,我想添加一个我尝试使用的“千分隔符”(表示货币)
@typeparam T
@inherits InputNumber<T>
<input @attributes="AdditionalAttributes"
type="number"
class="@CssClass"
value="@stringValue"
@oninput="OnInput"
@onblur="OnBlur" />
@code {
private string stringValue;
private T lastParsedValue;
protected override void OnParametersSet()
{
// Only overwrite the "stringValue" when the Value is different
if (!Equals(CurrentValue, lastParsedValue))
{
lastParsedValue = CurrentValue;
stringValue = CurrentValueAsString;
}
}
private void OnInput(ChangeEventArgs e)
{
// Update the value
CurrentValueAsString = stringValue = (string)e.Value;
lastParsedValue = CurrentValue;
}
private void OnBlur(FocusEventArgs e)
{
// Overwrite the stringValue property with the parsed value.
// This call Value.ToString(), so the value in the input is well formatted.
// note: Ensure the string value is valid before updating the content
if (!EditContext.GetValidationMessages(FieldIdentifier).Any())
{
stringValue = CurrentValueAsString;
}
}
}
但它不起作用
顺晟科技:
下面的组件直接继承自。是完成主要工作的地方,几乎肯定需要对我尚未考虑的特定情况和输入进行一些修补。
有关组件中的详细信息,请参阅注释。
组件:
@typeparam T
@inherits InputNumber<T>
<input @attributes="AdditionalAttributes"
type="number"
class="@CssClass"
value="@stringValue"
@oninput="OnInput"
@onblur="OnBlur" />
@code {
private string stringValue;
private T lastParsedValue;
protected override void OnParametersSet()
{
// Only overwrite the "stringValue" when the Value is different
if (!Equals(CurrentValue, lastParsedValue))
{
lastParsedValue = CurrentValue;
stringValue = CurrentValueAsString;
}
}
private void OnInput(ChangeEventArgs e)
{
// Update the value
CurrentValueAsString = stringValue = (string)e.Value;
lastParsedValue = CurrentValue;
}
private void OnBlur(FocusEventArgs e)
{
// Overwrite the stringValue property with the parsed value.
// This call Value.ToString(), so the value in the input is well formatted.
// note: Ensure the string value is valid before updating the content
if (!EditContext.GetValidationMessages(FieldIdentifier).Any())
{
stringValue = CurrentValueAsString;
}
}
}
测试页:
@typeparam T
@inherits InputNumber<T>
<input @attributes="AdditionalAttributes"
type="number"
class="@CssClass"
value="@stringValue"
@oninput="OnInput"
@onblur="OnBlur" />
@code {
private string stringValue;
private T lastParsedValue;
protected override void OnParametersSet()
{
// Only overwrite the "stringValue" when the Value is different
if (!Equals(CurrentValue, lastParsedValue))
{
lastParsedValue = CurrentValue;
stringValue = CurrentValueAsString;
}
}
private void OnInput(ChangeEventArgs e)
{
// Update the value
CurrentValueAsString = stringValue = (string)e.Value;
lastParsedValue = CurrentValue;
}
private void OnBlur(FocusEventArgs e)
{
// Overwrite the stringValue property with the parsed value.
// This call Value.ToString(), so the value in the input is well formatted.
// note: Ensure the string value is valid before updating the content
if (!EditContext.GetValidationMessages(FieldIdentifier).Any())
{
stringValue = CurrentValueAsString;
}
}
}
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11