看elementui源碼的時(shí)候發(fā)現(xiàn)這樣一段代碼:const uploadComponent = <upload {...uploadData}>{trigger}</upload>;return ( <div>
{ this.listType === 'picture-card' ? uploadList : ''}
{
this.$slots.trigger
? [uploadComponent, this.$slots.default]
: uploadComponent
}
{this.$slots.tip}
{ this.listType !== 'picture-card' ? uploadList : ''} </div>);這里為什么可以直接給js變量賦值為一個(gè)組件結(jié)構(gòu)呢?再下面結(jié)構(gòu)還可以當(dāng)做返回值?想請(qǐng)教下這種寫(xiě)法相關(guān)的知識(shí)點(diǎn)?這是js語(yǔ)法還是vue語(yǔ)法?
請(qǐng)教在element源碼中的一種寫(xiě)法
達(dá)令說(shuō)
2018-11-13 21:29:30