最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to configure dxFileUploader to show up like a simple button? - Stack Overflow

programmeradmin0浏览0评论

I have a dxFileUploader:

<div data-bind="dxFileUploader: { buttonText: 'Select file', labelText: 'Drop file here', accept: 'image/*' }"></div>

On the UI I got a surrounding white area (div).

How to get rid of it? I need only a simple button with an icon and no text that looks like this:

<div data-bind="dxButton: { icon: 'arrowup' }"></div>

I have a dxFileUploader:

<div data-bind="dxFileUploader: { buttonText: 'Select file', labelText: 'Drop file here', accept: 'image/*' }"></div>

On the UI I got a surrounding white area (div).

How to get rid of it? I need only a simple button with an icon and no text that looks like this:

<div data-bind="dxButton: { icon: 'arrowup' }"></div>
Share Improve this question edited Feb 18, 2015 at 11:33 user2005634 asked Feb 18, 2015 at 11:17 user2005634user2005634 1995 silver badges13 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

Use following styling for your file uploader

.dx-fileuploader, 
.dx-fileuploader * {
    display: inline-block;    
    margin: 0;
    vertical-align: middle;
}
.dx-fileuploader-input-container {
    display: none;
}
.dx-fileuploader-wrapper, 
.dx-fileuploader-input-wrapper{
    padding: 0;
    border: none;
}

To set icon to the button do following

$("#fileUploader").find(".dx-button").dxButton("option", "icon", "arrowup");

If you also need to hide selected files information add one more css rule

.dx-fileuploader-files-container {
    display: none;
}

See the fiddle http://jsfiddle/tabalinas/uf5vzgdw/

Simply just set [showFileList]="false"

ex:

<dx-file-uploader
  selectButtonText="Select File..."
   [showFileList]="false"
   labelText
   accept="image/*"
   uploadMode="useForm">
 </dx-file-uploader>

you can hack with fontawesome in

onContentReady = e => {
    const node = document.createElement('I');
    node.className = 'cstm-icon fas fa-upload'
    document.querySelector('.uploader-container .dx-button-text').appendChild(node);
}

and add some css

发布评论

评论列表(0)

  1. 暂无评论