简体   繁体   English

隐藏时如何打开组件 v-file-input?

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

I need to use component v-file-input for upload file.我需要使用组件v-file-input来上传文件。 But this component not suitable for design.但是这个组件不适合设计。

I try do next.我尝试下一步。 I made this component whole hidden <v-file-input hide-input prepend-icon=""></v-file-input> .我让这个组件完全隐藏<v-file-input hide-input prepend-icon=""></v-file-input> Also I made a button, design I need.我还做了一个按钮,我需要的设计。 But I can not start component v-file-input in method by click the button.但是我无法通过单击按钮在方法中启动组件v-file-input

How can I start this component in the method?如何在方法中启动此组件?

You can try to make label as button, and call method on label click:你可以尝试把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