Skip to content

Commit

Permalink
fix(Upload): use the correct slot name
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Sep 5, 2022
1 parent af3cf6e commit 922d01b
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 4 deletions.
2 changes: 1 addition & 1 deletion script/update-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path');
const fs = require('fs');

const iconFile = path.join(__dirname, '..', 'src/icon/icon.less');
const dataFile = path.join(__dirname, '..', 'example/pages/icon/data.js');
const dataFile = path.join(__dirname, '..', 'src/icon/_example/data.js');
fs.readFile(iconFile, 'utf8', (err, data) => {
if (err) {
console.error(err);
Expand Down
150 changes: 150 additions & 0 deletions src/icon/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,21 @@ exports[`Icon Icon base demo works fine 1`] = `
file-excel
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="file-icon"
name="file-icon"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
file-icon
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand Down Expand Up @@ -1730,6 +1745,21 @@ exports[`Icon Icon base demo works fine 1`] = `
hourglass
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="image-error"
name="image-error"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
image-error
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand Down Expand Up @@ -2090,6 +2120,51 @@ exports[`Icon Icon base demo works fine 1`] = `
logo-ie
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="logo-qq"
name="logo-qq"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
logo-qq
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="logo-wechat"
name="logo-wechat"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
logo-wechat
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="logo-wecom"
name="logo-wecom"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
logo-wecom
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand Down Expand Up @@ -2225,6 +2300,21 @@ exports[`Icon Icon base demo works fine 1`] = `
minus-rectangle
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="mirror"
name="mirror"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
mirror
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand Down Expand Up @@ -2450,6 +2540,21 @@ exports[`Icon Icon base demo works fine 1`] = `
photo
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="pin-filled"
name="pin-filled"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
pin-filled
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand Down Expand Up @@ -2645,6 +2750,21 @@ exports[`Icon Icon base demo works fine 1`] = `
refresh
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="relativity"
name="relativity"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
relativity
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand Down Expand Up @@ -2675,6 +2795,21 @@ exports[`Icon Icon base demo works fine 1`] = `
rollback
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="rollfront"
name="rollfront"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
rollfront
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand All @@ -2690,6 +2825,21 @@ exports[`Icon Icon base demo works fine 1`] = `
root-list
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
<t-icon
data-name="rotation"
name="rotation"
size="48rpx"
bind:click="onIconTap"
/>
<wx-view
class="demo__card-name"
>
rotation
</wx-view>
</wx-view>
<wx-view
class="demo__card"
>
Expand Down
2 changes: 2 additions & 0 deletions src/upload/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ exports[`Upload Upload single demo works fine 1`] = `
class="wrapper"
>
<t-upload
addContent="slot"
config="{{
Object {
"count": 1,
Expand Down Expand Up @@ -87,6 +88,7 @@ exports[`Upload Upload single demo works fine 1`] = `
color="rgba(0,0,0,0.26)"
name="add"
size="40rpx"
slot="add-content"
/>
</t-upload>
</wx-view>
Expand Down
3 changes: 2 additions & 1 deletion src/upload/_example/single/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"component": true,
"usingComponents": {
"t-upload": "tdesign-miniprogram/upload/upload"
"t-upload": "tdesign-miniprogram/upload/upload",
"t-icon": "tdesign-miniprogram/icon/icon"
}
}
3 changes: 2 additions & 1 deletion src/upload/_example/single/index.wxml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<view class="wrapper">
<t-upload
addContent="slot"
mediaType="{{['video','image']}}"
files="{{originFiles}}"
gridConfig="{{gridConfig}}"
config="{{config}}"
bind:success="handleSuccess"
bind:remove="handleRemove"
>
<t-icon name="add" size="40rpx" color="rgba(0,0,0,0.26)" />
<t-icon slot="add-content" name="add" size="40rpx" color="rgba(0,0,0,0.26)" />
</t-upload>
</view>
2 changes: 1 addition & 1 deletion src/upload/upload.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
>
<view class="{{classPrefix}}__wrapper" style="{{gridItemStyle}}">
<view class="{{classPrefix}}__add-icon">
<slot wx:if="{{addContent === 'slot'}}" name="addContent" />
<slot wx:if="{{addContent === 'slot'}}" name="add-content" />
<t-icon wx:else name="add" size="40rpx" color="rgba(0,0,0,0.26)" />
</view>
</view>
Expand Down

0 comments on commit 922d01b

Please sign in to comment.