Skip to content

关于在tabs里使用upload组件时的问题 #5751

Answered by nekorrrr
nekorrrr asked this question in Q&A
Discussion options

You must be logged in to vote

问题解决了,需要绑定v-model:file-list来维持选择的文件

<template>
  <n-tabs default-value="oasis" justify-content="space-evenly" type="line">
    <n-tab-pane name="oasis" tab="Oasis">
        <n-upload
          action="https://www.mocky.io/v2/5e4bafc63100007100d8b70f"
          :headers="{
            'naive-info': 'hello!',
          }"
          :data="{
            'naive-data': 'cool! naive!',
          }"
          v-model:file-list="fileList"
        >
          <n-button>上传文件</n-button>
        </n-upload>
    </n-tab-pane>
    <n-tab-pane name="the beatles" tab="the Beatles"> Hey Jude </n-tab-pane>
    <n-tab-pane name="jay chou" tab="周杰伦"> 七里香 </n-tab-pane>
  </n-tabs>
</template>
<script>
import { 

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by nekorrrr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant