[youzan/vant]vant-fied建议支持删除线

2024-05-22 550 views
7

vant-field目前不支持删除线, 类似核销卡券之类的场景,需要设置文字样式为删除线

如果通过class直接给vant-field设置 文字删除线, 会导致error-message的文字样式也带删除线。 所以需要开放接口出来

回答

0

你的场景是什么样的,能给张图片嘛,是左侧文本上显示删除线,还是输入框内容显示删除线

6
2018-12-21 12 40 26

其实场景很简单,就是类似优惠券的注销,需要设置text带删除线,

我只能在van-field上面加class,但是会导致错误提示也是删除线,如上图,

                    <van-field v-model="couponCode1"
                               center
                               clearable
                               placeholder="请输入优惠码1"
                               :class="[inputCouponCodeClass]"
                               :error-message="couponCode1ErrorMessage"
                    >
inputCouponCodeClass
    text-decoration: line-through
8

感觉这并不是个常用的场景... 一般要点核销按钮才请求接口券号是否核销, 已核销的基本会弹窗提示的吧.

如果真的要改删除线, 直接加个全局样式覆盖好了

3

image

                    <van-field v-model="couponCode1"
                               center
                               clearable
                               placeholder="请输入优惠码1"
                               class="delete-line"
                               :error-message="couponCode1ErrorMessage"
                    >
.van-cell.van-field.delete-line input {
  text-decoration: line-through
}
7

ok