You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PrimeVue DatePicker通过PassThrough添加自定义样式失败

PrimeVue DatePicker 自定义PT样式不生效的解决方法

你用错了PassThrough的键名,pcInputText不是DatePicker输入框对应的PT标识,换成input就能生效:

<DatePicker
      v-model="date"
      dateFormat="yy/mm/dd"
      size="small"
      panelClass="custom"
      :pt="{
        input: {
          style: {
            'text-align': 'center',
            'font-size': 'xx-large',
            'background-color': 'rgba(0, 0, 0, 0.2)',
          },
        }
}" />

如果需要调整组件其他部分的样式,可查阅PrimeVue官方文档中DatePicker的PassThrough完整结构,确认对应元素的键名。

样式对比:

  • 默认样式:默认样式
  • 期望样式:期望样式

内容的提问来源于stack exchange,提问作者Hsun

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 16:07:32