Vue中使用v-bind绑定对象时布尔值被转换为字符串的问题 #13776
              
                
                  
                  
                    Answered
                  
                  by
                    xie392
                  
              
          
                  
                    
                      xie392
                    
                  
                
                  asked this question in
                Help/Questions
              
            -
| 问题现象在Vue项目中,我使用v-bind绑定一个配置对象到组件属性时,遇到了类型转换问题: 报错信息:
 我的配置数据:{
  label: '结算费用',
  prop: 'stationExpenses',
  type: 'input',
  attrs: {
    disabled: true,  // 这里是布尔值
  },
}模板使用:<a-input
  v-model="businessFormData.basicInfo[item.prop]"
  v-bind="item.attrs"
/>问题分析使用 v-bind="item.attrs" 时,原本的布尔值 true 被转换成了字符串 "true",导致组件的 prop 类型检查失败。 疑问为什么Vue的v-bind会将布尔值转换为字符串? 环境信息Vue版本:2.x | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            xie392
          
      
      
        Aug 18, 2025 
      
    
    Replies: 1 comment
-
| 已解决,是因为本人没有传对值的原因 | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        xie392
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
已解决,是因为本人没有传对值的原因