【发布时间】:2021-12-11 20:56:41
【问题描述】:
我想将我在 URL 的文本框中设置的变量放在我的域名后面。像这样:
https://localhost:44305/变量。
我已经看到你可以在 URL 中传递一个变量,但不能在 URL 之后动态地写一个变量,例如文本框。
How to pass a URL input parameter value to Blazor page?
<input @bind="ErrorCode"/>
<!--With the Input i fetch the a data from a database (searching for the right dataset with the input-ErrorCode).
The data i fetched from database is shown e.g. in a table-->
<br/>
<br/>
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
</table>
<!--My Problem now is, when the person who searched for an ErrorCode,
wants to send the URL to another person, the other person only gets the page, without an input value.-->
【问题讨论】:
-
你能发布一些你将如何使用它的上下文代码吗?
-
当然。我有一个来自文本框的输入,在那里我得到了值。 然后我使用该值从数据库中获取数据。现在,如果有人复制链接,我希望第三个人再次通过链接访问相同的错误代码或相同的数据集。 localhost:44305/ErrorCode.
-
不是我的意思。您能否在问题中提供一个简单的页面来展示您想要实现的目标?它不需要工作。
https://localhost:44305/Variable中的“ErrorCode”在哪里使用,https://localhost:44305/Variable导航到哪里?告诉我们可以阻止我们做出经常偏离标准的假设! -
我不太确定,如果这就是你的意思,但我希望如此 :)
-
到达那里。 “搜索错误代码的人,获取要发送给其他人的 url”到底在哪里。哪段代码从您将输入绑定到的变量/属性构造 URL?还是他们只是简单地输入“siteurl/errorcode”?