Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.7k views
in Technique[技术] by (71.8m points)

vue props 如何接受多个类型?

我的代码

props:{
    price_type:{
      required:true,
      type(){
        return Number | String
      },
      default:0
    }
  },

当我传递了 Number 0 还是发出了警告

[Vue warn] Invalid prop: type check failed for prop "price_type". Expected Type, got Number with value 1.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...