5

I want to go to a specific tab using vuejs and element-ui. Here is the jsfiddle file. https://jsfiddle.net/hutsu1zf/10/

By default it lands to first tab. How can I land on any other tab while page load event. I am new to vuejs so even some hints would be appreciated.

1

2 Answers 2

5

You can use the activeName attribute of tab. Look at this fiddle:

https://jsfiddle.net/hutsu1zf/21/

Change activeName as per your requirement.

Sign up to request clarification or add additional context in comments.

Comments

1

Notice the value attribute in el-tabs and the name in el-tab-pane:

<el-tabs type="border-card" value="2">
  <el-tab-pane   id="tab-1" label="Route">
    Route
  </el-tab-pane>
  <el-tab-pane id="tab-0"  label="Config">
    Config
  </el-tab-pane>
  <el-tab-pane id="tab-2" name="2" label="Role">
    Role
  </el-tab-pane>
  <el-tab-pane id="tab-3" label="Task">
    Task
  </el-tab-pane>
</el-tabs>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.