首页 > 解决方案 > 将部分视图附加到差异 ID 时未计算 mdc-floatin-label 宽度

问题描述

我将部分视图附加到 div 标签。

if (typeof response != "undefined") {
                $("#" + formID).find('#captcha-section').html(response);
            }

我的浮动标签 HTML 代码

 <label asp-for="ImageText" class="mdc-text-field text-field mdc-text-field--outlined phone-otp-label">
        <input asp-for="ImageText" class="mdc-text-field__input"
               aria-labelledby="lblImage"
               aria-describedby="helperImage"
               aria-controls="helperImage">
        <span class="mdc-notched-outline">
            <span class="mdc-notched-outline__leading"></span>
            <span class="mdc-notched-outline__notch">
                <span class="mdc-floating-label" id="lblImage">@Model.ImageTextLabel</span>
            </span>
            <span class="mdc-notched-outline__trailing"></span>
        </span>
    </label>

此处浮动标签未按预期工作。 在此处输入图像描述

标签: mdcmdc-componentsfloating-labels

解决方案


推荐阅读