vue中點(diǎn)擊不同按鈕跳轉(zhuǎn)同一頁面組件有什么好的傳參方式?

scope參數(shù)采用作用域插槽? ??slot-scope="scope"

toEdit (type, scope) {? ??

? ? ? let params

? ? ? if (type === 0) {

? ? ? ? params = {

? ? ? ? ? type: 'add',

? ? ? ? ? isRevert: 0,

? ? ? ? ? isCopy: 0

? ? ? ? }

? ? ? } else if (type === 1) {

? ? ? ? params = {

? ? ? ? ? type: 'edit',

? ? ? ? ? params: scope.row,

? ? ? ? ? isRevert: 0,

? ? ? ? ? isCopy: 0

? ? ? ? }

? ? ? } else if (type === 2) {

? ? ? ? params = {

? ? ? ? ? type: 'edit',

? ? ? ? ? params: scope.row,

? ? ? ? ? isRevert: 1,

? ? ? ? ? isCopy: 0

? ? ? ? }

? ? ? } else if (type === 3) {

? ? ? ? params = {

? ? ? ? ? type: 'add',

? ? ? ? ? params: scope.row,

? ? ? ? ? isRevert: 0,

? ? ? ? ? isCopy: 1

? ? ? ? }

? ? ? }

? ??? ? //toRouter定義的公共方法,參數(shù)分別為vue, routerName, routerObj

? ? ? this.$tools.toRouter(this, 'recruitEditPlanL1', params)

? ? }

<el-button type="primary" @click="toEdit(0)">新建招生規(guī)則</el-button>

<el-button? type="primary" @click="toEdit(1,scope)" >修改招生計(jì)劃 </el-button>

<el-button? type="primary" @click="toEdit(2,scope)">招生回滾 </el-button>


注意:以上采用vue? 2.5.17版本。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容