iview提示Invalid prop: custom validator check failed for prop “type“解决

报错如下:

提示:Invalid prop: custom validator check failed for prop “type”
在这里插入图片描述

解决

由上图可见,是input标签的type引起的报错。
在这里插入图片描述
在ivew官网文档中,input标签的type类型不支持hidden属性值,因此要么改,要么屏蔽即可。

详情请参考iview官方文档:http://v1.iviewui.com/components/input
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
iView 的 `PageTable` 中,当设置 `type:selection` 时,可以对选框进行自定义样式。可以通过以下两种方式实现: 1. 通过 `slot-scope` 自定义选框 在 `PageTable` 组件的 `selection` 插槽中,可以自定义选框的样式。例如: ```html <template> <PageTable :columns="columns" :data="data" :type="'selection'"> <template slot="selection" slot-scope="{ row, $index }"> <div class="my-checkbox" @click="onSelect($index)"> <Icon :type="isSelected($index) ? 'md-checkmark' : 'md-square-outline'" /> </div> </template> </PageTable> </template> <script> export default { data () { return { selected: [] } }, methods: { onSelect (index) { const i = this.selected.indexOf(index) if (i > -1) { this.selected.splice(i, 1) } else { this.selected.push(index) } }, isSelected (index) { return this.selected.indexOf(index) > -1 } } } </script> <style scoped> .my-checkbox { cursor: pointer; width: 20px; height: 20px; border: 1px solid #999; border-radius: 4px; display: flex; align-items: center; justify-content: center; } </style> ``` 其中,`isSelected` 方法用于判断某一行是否被选中,`onSelect` 方法用于处理选中事件。 2. 通过 CSS 自定义选框 可以通过 CSS 自定义选框的样式,例如: ```html <template> <PageTable :columns="columns" :data="data" :type="'selection'" class="my-table"> </PageTable> </template> <style scoped> .my-table .ivu-checkbox { margin-right: 10px; } .my-table .ivu-checkbox .ivu-checkbox-input { border: 1px solid #999; background-color: #fff; border-radius: 4px; } .my-table .ivu-checkbox .ivu-checkbox-inner { width: 16px; height: 16px; } .my-table .ivu-checkbox .ivu-checkbox-inner::after { width: 8px; height: 8px; top: 3px; left: 3px; border-radius: 2px; background-color: #333; } </style> ``` 其中,`.ivu-checkbox` 是 iView 内置的选框类名,可以通过该类名对选框进行样式定制。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

瓜仙人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值