3๐
โ
You could do this programatically:
-
Style the nav bar in
el-tabs
to setdisplay:flex
andjustify-content:space-between
:.el-tabs__nav-scroll { display: flex; justify-content: space-between; }
-
Add an
el-button
to the template, and give it a template ref (namedbtn
).<el-button ref="btn">Click me!</el-button>
-
Apply a template ref to the
el-tabs
component (namedtabs
).<el-tabs ref="tabs">
-
In the
mounted()
hook, insert theel-button
intoel-tabs
:export default { mounted() { const scrollBar = this.$refs.tabs.$el.querySelector('.el-tabs__nav-scroll') scrollBar.appendChild(this.$refs.btn.$el) } }
๐คtony19
0๐
I used the slot, the create button is obtained on the left.
<el-tabs>
<el-tab-pane
name="ExTab"
ref="ExTab"
>
ExTab
</el-tab-pane>
<el-tab-pane
name="add"
ref="add"
>
<span slot="label" >
<el-button
slot="reference"
type="primary"
round
icon="el-icon-plus"
style="margin: 0 1% 0 1% "
@click.stop="addTab()"
/>
</span>
</el-tab-pane>
</el-tabs>
Source:stackexchange.com