asp.net-core - Razor 页面表单中的 SVG
问题描述
我正在使用 Tailwind CSS、.NET Core 3.1 Razor Pages 并收到以下错误
Found a malformed 'input' tag helper. Tag helpers must have a start and end tag or be self closing
使用此代码
<form asp-route="Search" method="get">
<label for="place-address" class="block text-sm font-medium leading-5 text-gray-700">Enter your address</label>
<div class="mt-1 flex rounded-md shadow-sm">
<div class="relative flex-grow focus-within:z-10">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-5 w-5 text-gray-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clip-rule="evenodd" />
</svg>
</div>
<input asp-for="Address" id="place-address" class="form-input block w-full rounded-none rounded-l-md pl-10 transition ease-in-out duration-150 sm:text-sm sm:leading-5" />
</div>
<button type="submit" class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm leading-5 font-medium rounded-r-md text-gray-700 bg-gray-50 hover:text-gray-500 hover:bg-white focus:outline-none focus:shadow-outline-blue focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">
<svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" ">
<path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
<span class="ml-2">Search</span>
</button>
</div>
</form>
当我删除 SVG 元素时,错误消失了。如何保留 SVG 元素并使此表单正常工作
解决方案
推荐阅读
- kdb - 在 Q 中,如何从 Kdb 表中获取最后 X 分钟的行?
- postgresql - 过滤日期,其中日期是上个季度的日期
- javascript - 为什么razorpay 支付网关显示此错误?
- php - Symfony 5:驱动程序发生异常:找不到驱动程序
- javascript - glyphicon-calendar 显示禁用分钟选项
- sudo - Using Yubikey to secure sudo
- jekyll - My bootstrap dropdown menu works on local host but not on github
- django - 在 django 中重写 AND/OR 查询
- java - Unable to build FatJAR using the shadowJar plugin in Gradle
- azure - 使用 Terraform 在 Azure 中创建多个 VM 并为这些 VM 分配角色。(卡在 for_each 循环中)