html - 在数字输入中添加 SVG
问题描述
我有一个数字输入表单字段。
<input type="number" name="" v-model.lazy="userResponse" placeholder="Enter value here" class="bg-white border-gray-300 border-2 text-gray-600 shadow-md px-6 py-4 rounded-lg my-2" :class="{ 'border-teal-500 border-2' : isCorrect }" :disabled="showFeedbackView">
它给了我这个:
只要 isCorrect 值为真,我想在值旁边添加一个 svg 复选标记图标。
有没有办法做到这一点?
解决方案
is-correct
使用以下规则添加类:
.is-correct{
background-image: url(/path/to/success.svg);
}
并像这样使用它:
:class="{ 'border-teal-500 border-2 is-correct' : isCorrect }"
推荐阅读
- python-3.x - 在 Macbook 上安装 TA-Lib
- python - 如何更改问题解决格式以使用 lambda 和/或 map (Python)
- python - 使用带有 numpy 的 if else 语句进行算术计算
- reactjs - React + Firebase 身份验证:在不更改当前登录用户的情况下创建新用户
- amazon-web-services - 雅典娜返回返回零结果
- javascript - Typescript过滤器中回调函数的类型是什么?
- laravel - Laravel Excel:错误资源解释为文档但使用 MIME 传输
- vue.js - 在下面文件的vue JS中获取“在调用reset()时无法读取未定义错误的属性'map'”
- visual-studio-code - 单击“运行代码”时,Visual Studio Code 的 Code Runner 扩展不起作用
- html - 从选择值计算的任何选项