Welcome to Jonic Developer Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

关于vue props传参的一个写法问题 内附代码

<commonHeader 
:title="'自定义标题'" 
:iconShowFlag="true"
></commonHeader>
props:{
    title:{
        type:String,
        default:""
    },
    iconShowFlag:{
        type:Boolean,
        default:true
    }
},

使用这个组件的时候

我希望可以写成这样 :title="自定义标题"

不想写成 :title="'自定义标题'"

这个应该怎么写呢 请教


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

1 Answer

0 votes
by (71.8m points)

你应该写成title="自定义标题"吧


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

548k questions

547k answers

4 comments

40.3k users

...