簡體   English   中英

隱藏時如何打開組件 v-file-input?

[英]How to open component v-file-input, when it is hidden?

我需要使用組件v-file-input來上傳文件。 但是這個組件不適合設計。

我嘗試下一步。 我讓這個組件完全隱藏<v-file-input hide-input prepend-icon=""></v-file-input> 我還做了一個按鈕,我需要的設計。 但是我無法通過單擊按鈕在方法中啟動組件v-file-input

如何在方法中啟動此組件?

你可以嘗試把label做成按鈕,調用label上的方法點擊:

 .upload { margin: 2em; } #btn { border: 2px solid #3457D5; border-radius: .5em; padding: 1em; cursor: pointer; } #btn:hover { background: #3457D5; color: white; }
 <div class="upload"> <input id="up" type="file" style="display: none" /> <label id="btn" for="up">Upload</label> </div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM