|
| 1 | +<template> |
| 2 | + <div class="components"> |
| 3 | + <h3>Props</h3> |
| 4 | + <p>Vue-core-image-upload supports many props to meet developers'needs.</p> |
| 5 | + <p>Code Example</p> |
| 6 | + <pre v-highlightjs><code class="html"><vue-core-image-upload |
| 7 | + :class="['btn', 'btn-primary']" |
| 8 | + :crop="false" |
| 9 | + @imageuploaded="imageuploaded" |
| 10 | + :data="data" |
| 11 | + :max-file-size="5242880" |
| 12 | + url="http://101.198.151.190/api/upload.php" > |
| 13 | +</vue-core-image-upload></code></pre> |
| 14 | + <p>'class', 'url' and 'max-file-size' are different props. And the table below simply introduces how it work.</p> |
| 15 | + <p> |
| 16 | + <table class="m-table bordered"> |
| 17 | + <thead> |
| 18 | + <tr> |
| 19 | + <th>Props</th> |
| 20 | + <th align="left">Data Type</th> |
| 21 | + <th>Example</th> |
| 22 | + <th>Details</th> |
| 23 | + </tr> |
| 24 | + </thead> |
| 25 | + <tbody> |
| 26 | + <tr> |
| 27 | + <td>url</td> |
| 28 | + <td align="left">String</td> |
| 29 | + <td>'/crop.php'</td> |
| 30 | + <td>Your server api</td> |
| 31 | + </tr> |
| 32 | + <tr> |
| 33 | + <td>text</td> |
| 34 | + <td align="left">String</td> |
| 35 | + <td>'Upload Image'</td> |
| 36 | + <td>The text of your uploading button</td> |
| 37 | + </tr> |
| 38 | + <tr> |
| 39 | + <td>inputOfFile</td> |
| 40 | + <td align="left">String </td> |
| 41 | + <td> 'file'</td> |
| 42 | + <td>Yout input[file] name</td> |
| 43 | + </tr> |
| 44 | + <tr> |
| 45 | + <td>extensions</td> |
| 46 | + <td align="left">String</td> |
| 47 | + <td>'png,jpg,gif'</td> |
| 48 | + <td>Limit the image type</td> |
| 49 | + </tr> |
| 50 | + <tr> |
| 51 | + <td>crop</td> |
| 52 | + <td align="left">Boolean</td> |
| 53 | + <td>'server'</td> |
| 54 | + <td>Crop image option</td> |
| 55 | + </tr> |
| 56 | + <tr> |
| 57 | + <td>cropRatio</td> |
| 58 | + <td align="left">String</td> |
| 59 | + <td>'1:1'</td> |
| 60 | + <td>The cropped image shape</td> |
| 61 | + </tr> |
| 62 | + <tr> |
| 63 | + <td>cropBtn</td> |
| 64 | + <td align="left">Object</td> |
| 65 | + <td>{ok:'Save','cancel':'Give Up'}</td> |
| 66 | + <td>The Text of cropping button text</td> |
| 67 | + </tr> |
| 68 | + <tr> |
| 69 | + <td>maxFileSize</td> |
| 70 | + <td align="left">Number</td> |
| 71 | + <td>10485760(10M)</td> |
| 72 | + <td>Limit the size of the file</td> |
| 73 | + </tr> |
| 74 | + <tr> |
| 75 | + <td>maxWidth</td> |
| 76 | + <td align="left">Number</td> |
| 77 | + <td>150</td> |
| 78 | + <td>The maximum width of cropped image </td> |
| 79 | + </tr> |
| 80 | + <tr> |
| 81 | + <td>maxheight</td> |
| 82 | + <td align="left">Number</td> |
| 83 | + <td>150</td> |
| 84 | + <td>限制图片的最大高度</td> |
| 85 | + </tr> |
| 86 | + <tr> |
| 87 | + <td>inputAccept</td> |
| 88 | + <td align="left">string</td> |
| 89 | + <td>'image/*' / 'image/jpg,image/jpeg,image/png'</td> |
| 90 | + <td>the input[file] accept</td> |
| 91 | + </tr> |
| 92 | + <tr> |
| 93 | + <td>compress</td> |
| 94 | + <td align="left">Number</td> |
| 95 | + <td>50</td> |
| 96 | + <td>Set the quality of compressed image</td> |
| 97 | + </tr> |
| 98 | + <tr> |
| 99 | + <td>isXhr</td> |
| 100 | + <td align="left">Boolean</td> |
| 101 | + <td>true</td> |
| 102 | + <td>IF cancel ajax uploading</td> |
| 103 | + </tr> |
| 104 | + <tr> |
| 105 | + <td>headers</td> |
| 106 | + <td align="left">Object</td> |
| 107 | + <td>{auth: xxxxx}</td> |
| 108 | + <td>Set customed header when ajax uploading</td> |
| 109 | + </tr> |
| 110 | + <tr> |
| 111 | + <td>data</td> |
| 112 | + <td align="left">Object</td> |
| 113 | + <td>{auth: xxxxx}</td> |
| 114 | + <td>Set customed data when ajax posting server</td> |
| 115 | + </tr> |
| 116 | + </tbody> |
| 117 | + </table> |
| 118 | + </p> |
| 119 | + <h4> url </h4> |
| 120 | + <p><code>url</code> means a http url that ajax will send,and you need bind a function on <code>@imageuploaded</code> to handle the server response</p> |
| 121 | + <h4>inputOfFile</h4> |
| 122 | + <p>You can set input[file] name which the server must use via <code>inputOfFile</code>. The default value is <strong>files</strong>。 |
| 123 | + If you upload multiple images the name will be <strong>files[]</strong>。</p> |
| 124 | + <h4>extensions</h4> |
| 125 | + <p>If you want only one or two image types to upload to server, <code>extensions</code> is the right way when you pass an CSV string to it.</p> |
| 126 | + <h4>maxFileSize</h4> |
| 127 | + <p>Even though the server would check the file size , you cloud also limit the file size locally for thrifting the traffic of network.</p> |
| 128 | + <h4>isXhr</h4> |
| 129 | + <p>Set <code>isXhr</code> equal <code>false</code>, the uploading will be canceld and you can do something by yourself.</p> |
| 130 | + <p class="warnning">The naviagtion will show other props documents and demos</p> |
| 131 | + </div> |
| 132 | +</template> |
0 commit comments