Skip to content

Commit 12f5040

Browse files
yangxiaolu1993richard1015Ymm0008wlchnDrjingfubo
authored
feat: 新增 Comment 评论组件 (#1)
* fix(uploader): taro h5 env upload error #1096 * fix: taro 3.4.6 sass calc error #1200 * fix(uploader): taro env formdata type error * chore: add international components signature * chore: add international components ecard * chore: add international components timeselect * chore: add international components sku * fix: demo textarea 自适应 (#1201) * feat: add translations chinese traditional * docs: open international * fix: input show-word-limit default false (#1203) * refactor(circleprogress): add features (#1204) * fix(popup): 修复popup在Taro转H5下的渲染问题 * feat: avatar能力补齐、input doc文档更新 (#1195) * fix: 修改input单元测试 * fix: 增加avatar group * fix: 更新input md * fix: avatar能力补齐 * fix: avatar能力补齐、适配taro * feat: 迁移 AddressList、Category 组件,适配taro * fix: 修改input md Co-authored-by: richard1015 <[email protected]> * chore: add international components addresslist Co-authored-by: richard1015 <[email protected]> Co-authored-by: Ymm <[email protected]> Co-authored-by: Lei Wang <[email protected]> Co-authored-by: Drjingfubo <[email protected]> Co-authored-by: suzigang <[email protected]> Co-authored-by: ailululu <[email protected]>
1 parent 84d0c96 commit 12f5040

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+7588
-734
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"checked:taro:vue": "npm run generate:file:taro:vue",
3838
"dev": "npm run checked && vite --open --force",
3939
"dev:taro:vue": "npm run createTaroConfig && npm run checked:taro:vue && cd src/sites/mobile-taro/vue/ && npm run dev:weapp",
40-
"dev:taro:h5": "npm run checked:taro:vue && cd src/sites/mobile-taro/vue/ && npm run dev:h5",
40+
"dev:taro:h5": "npm run createTaroConfig && npm run checked:taro:vue && cd src/sites/mobile-taro/vue/ && npm run dev:h5",
4141
"build:site": "npm run checked && vite build",
4242
"build:site:oss": "npm run checked && vite build --base=/nutui/3x/",
4343
"build": "npm run checked && vite build --config vite.config.build.ts && vite build --config vite.config.build.disperse.ts && npm run generate:types && npm run generate:themes && vite build --config vite.config.build.css.ts",
@@ -65,7 +65,7 @@
6565
}
6666
},
6767
"dependencies": {
68-
"sass": "~1.32.0",
68+
"sass": "^1.50.0",
6969
"vue-router": "^4.0.12"
7070
},
7171
"devDependencies": {

src/config.json

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
{
2626
"name": "international",
2727
"cName": "国际化",
28-
"show": false
28+
"show": true
2929
},
3030
{
3131
"name": "resource",
@@ -768,6 +768,29 @@
768768
"name": "展示组件",
769769
"enName": "exhibition",
770770
"packages": [
771+
{
772+
"version": "3.0.0",
773+
"name": "Avatar",
774+
"taro": true,
775+
"sort": 7,
776+
"cName": "头像",
777+
"type": "component",
778+
"show": true,
779+
"desc": "头像",
780+
"author": "ailululu"
781+
},
782+
{
783+
"version": "3.0.0",
784+
"name": "AvatarGroup",
785+
"taro": true,
786+
"sort": 1,
787+
"cName": "头像组件",
788+
"type": "component",
789+
"show": false,
790+
"exportEmpty": true,
791+
"desc": "头像组合组件",
792+
"author": "ailululu"
793+
},
771794
{
772795
"version": "3.0.0",
773796
"name": "List",
@@ -884,17 +907,6 @@
884907
"desc": "轮播图子组件",
885908
"author": "suzigang"
886909
},
887-
{
888-
"version": "3.0.0",
889-
"name": "Avatar",
890-
"taro": true,
891-
"sort": 7,
892-
"cName": "头像",
893-
"type": "component",
894-
"show": true,
895-
"desc": "头像",
896-
"author": "ailululu"
897-
},
898910
{
899911
"version": "3.0.0",
900912
"name": "Price",
@@ -1126,6 +1138,35 @@
11261138
},
11271139
{
11281140
"version": "3.0.0",
1141+
"name": "AddressList",
1142+
"type": "component",
1143+
"cName": "地址列表",
1144+
"desc": "展示收货地址列表",
1145+
"show": true,
1146+
"author": "yushuang24",
1147+
"taro": true
1148+
},
1149+
{
1150+
"version": "3.0.0",
1151+
"name": "Category",
1152+
"type": "component",
1153+
"cName": "商品分类",
1154+
"desc": "商品分类展示",
1155+
"show": true,
1156+
"author": "liqiong43",
1157+
"taro": true
1158+
},
1159+
{
1160+
"version": "3.0.0",
1161+
"name": "CategoryPane",
1162+
"type": "component",
1163+
"cName": "商品分类面板",
1164+
"desc": "商品分类面板",
1165+
"show": false,
1166+
"exportEmpty": true,
1167+
"author": "liqiong43",
1168+
"taro": true
1169+
},{
11291170
"name": "Comment",
11301171
"cType": "特色组件",
11311172
"cName": "商品评论",
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<template>
2+
<div class="nut-general-shell">
3+
<item-contents
4+
:item="item"
5+
@delIconClick="delShellClick"
6+
@editIconClick="editShellClick"
7+
@itemClick="itemShellClick"
8+
>
9+
<template v-slot:contentTop>
10+
<slot name="contentInfo"></slot>
11+
</template>
12+
<template v-slot:contentIcon>
13+
<slot name="contentIcons"></slot>
14+
</template>
15+
<template v-slot:contentAddr>
16+
<slot name="contentAddrs"></slot>
17+
</template>
18+
</item-contents>
19+
</div>
20+
</template>
21+
<script lang="ts">
22+
import { ref, watch, reactive, toRefs, onMounted, useSlots } from 'vue';
23+
import { createComponent } from '../../../utils/create';
24+
const { componentName, create } = createComponent('general-shell');
25+
import ItemContents from './ItemContents.vue';
26+
27+
export default create({
28+
props: {
29+
item: {
30+
type: Object,
31+
default: {}
32+
}
33+
},
34+
emits: ['handleDelIcon', 'handleEditIcon', 'handleItemContent', 'handelSwipeDel'],
35+
components: {
36+
ItemContents
37+
},
38+
39+
setup(props: any, { emit, slots }) {
40+
const delShellClick = (event, item) => {
41+
emit('handleDelIcon', event, props.item);
42+
event.stopPropagation();
43+
};
44+
const editShellClick = (event, item) => {
45+
emit('handleEditIcon', event, props.item);
46+
event.stopPropagation();
47+
};
48+
const itemShellClick = (event, item) => {
49+
emit('handleItemContent', event, props.item);
50+
event.stopPropagation();
51+
};
52+
const swipeDelClick = (event, item) => {
53+
emit('handelSwipeDel', event, props.item);
54+
event.stopPropagation();
55+
};
56+
return {
57+
delShellClick,
58+
editShellClick,
59+
itemShellClick,
60+
swipeDelClick
61+
};
62+
}
63+
});
64+
</script>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<div class="nut-item-contents__contain" @click="contentsClick">
3+
<div class="nut-item-contents__info">
4+
<div class="nut-item-contents__info-contact">
5+
<slot name="contentTop">
6+
<div class="nut-item-contents__info-contact-name">{{ item.addressName }}</div>
7+
<div class="nut-item-contents__info-contact-tel">{{ item.phone }}</div>
8+
<div class="nut-item-contents__info-contact-default" v-if="item.defaultAddress">默认</div>
9+
</slot>
10+
</div>
11+
<div class="nut-item-contents__info-handle">
12+
<slot name="contentIcon">
13+
<nut-icon name="del" class="nut-item-contents__info-handle-del" @click="delClick"></nut-icon>
14+
<nut-icon name="edit" class="nut-item-contents__info-handle-edit" @click="editClick"></nut-icon>
15+
</slot>
16+
</div>
17+
</div>
18+
<div class="nut-item-contents__addr">
19+
<slot name="contentAddr">
20+
{{ item.fullAddress }}
21+
</slot>
22+
</div>
23+
</div>
24+
</template>
25+
<script lang="ts">
26+
import { toRefs, reactive, onMounted, ref, watch } from 'vue';
27+
import { createComponent } from '../../../utils/create';
28+
const { componentName, create } = createComponent('item-contents');
29+
30+
export default create({
31+
props: {
32+
name: {
33+
type: String,
34+
default: ''
35+
},
36+
item: {
37+
type: Object,
38+
default: {}
39+
}
40+
},
41+
components: {},
42+
emits: ['delIconClick', 'editIconClick', 'itemClick'],
43+
44+
setup(props, { emit }) {
45+
const delClick = (event: Event) => {
46+
emit('delIconClick', event, props.item);
47+
console.log(123);
48+
event.stopPropagation();
49+
};
50+
const editClick = (event: Event) => {
51+
emit('editIconClick', event, props.item);
52+
event.stopPropagation();
53+
};
54+
const contentsClick = (event: event) => {
55+
emit('itemClick', event, props.item);
56+
event.stopPropagation();
57+
};
58+
59+
return {
60+
delClick,
61+
editClick,
62+
contentsClick
63+
};
64+
}
65+
});
66+
</script>
67+
68+
<style lang="scss">
69+
/* @import './index.scss'; */
70+
</style>
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<template>
2+
<div class="nut-long-press-shell">
3+
<div
4+
class="nut-long-press-shell__contain"
5+
@touchstart="holddownstart"
6+
@touchend="holddownend"
7+
@touchmove="holddownmove"
8+
>
9+
<item-contents
10+
:item="item"
11+
@delIconClick="delShellClick"
12+
@editIconClick="editShellClick"
13+
@itemClick="itemShellClick"
14+
>
15+
<template v-slot:contentTop>
16+
<slot name="contentInfo"></slot>
17+
</template>
18+
<template v-slot:contentIcon>
19+
<slot name="contentIcons"></slot>
20+
</template>
21+
<template v-slot:contentAddr>
22+
<slot name="contentAddrs"></slot>
23+
</template>
24+
</item-contents>
25+
<div class="nut-long-press-shell__contain-mask" v-if="showMaskRef" @click="maskClick">
26+
<slot name="longpressAll">
27+
<div class="nut-long-press-shell__contain-mask-copy" @click="copyCLick">
28+
<div class="mask-contain"> 复制<br />地址 </div>
29+
</div>
30+
<div class="nut-long-press-shell__contain-mask-set" @click="setDefault">
31+
<div class="mask-contain"> 设置<br />默认 </div>
32+
</div>
33+
<div class="nut-long-press-shell__contain-mask-del" @click="delClick">
34+
<div class="mask-contain"> 删除<br />地址 </div>
35+
</div>
36+
</slot>
37+
</div>
38+
</div>
39+
<div class="nut-addresslist__mask-bottom" v-if="showMaskRef" @click="hideMaskClick"></div>
40+
</div>
41+
</template>
42+
<script lang="ts">
43+
import { ref, watch, reactive, toRefs, onMounted, useSlots } from 'vue';
44+
import { createComponent } from '../../../utils/create';
45+
const { componentName, create } = createComponent('long-press-shell');
46+
import ItemContents from './ItemContents.vue';
47+
48+
export default create({
49+
props: {
50+
item: {
51+
type: Object,
52+
default: {}
53+
}
54+
},
55+
emits: [
56+
'holdingDown',
57+
'handleDel',
58+
'handelMask',
59+
'handleCopy',
60+
'handleSet',
61+
'handleDelIcon',
62+
'handleEditIcon',
63+
'handleItemContent'
64+
],
65+
components: {
66+
ItemContents
67+
},
68+
69+
setup(props: any, { emit, slots }) {
70+
let loop = null;
71+
const showMaskRef = ref(false);
72+
const holdingFunc = (event: Event) => {
73+
loop = 0;
74+
showMaskRef.value = true;
75+
emit('holdingDown', event, props.item);
76+
};
77+
//长按功能实现
78+
const holddownstart = (event: Event) => {
79+
loop = setTimeout(() => {
80+
holdingFunc(event);
81+
}, 300);
82+
};
83+
const holddownmove = (event: Event) => {
84+
//滑动不触发长按
85+
clearTimeout(loop);
86+
};
87+
const holddownend = (event: Event) => {
88+
//删除定时器,防止重复注册
89+
clearTimeout(loop);
90+
};
91+
const hideMaskClick = (event: Event) => {
92+
showMaskRef.value = false;
93+
};
94+
const copyCLick = (event: Event) => {
95+
if (loop == 0) return; //排除长按时触发点击的情况
96+
emit('handleCopy', event, props.item);
97+
event.stopPropagation();
98+
};
99+
const setDefault = (event: Event) => {
100+
if (loop == 0) return; //排除长按时触发点击的情况
101+
emit('handleSet', event, props.item);
102+
event.stopPropagation();
103+
};
104+
const delClick = (event: Event) => {
105+
if (loop == 0) return; //排除长按时触发点击的情况
106+
emit('handleDel', event, props.item);
107+
event.stopPropagation();
108+
};
109+
const maskClick = (event: Event) => {
110+
if (loop != 0) {
111+
//排除长按时触发点击的情况
112+
showMaskRef.value = false;
113+
}
114+
event.stopPropagation();
115+
event.preventDefault();
116+
};
117+
const delShellClick = (event, item) => {
118+
emit('handleDelIcon', event, props.item);
119+
event.stopPropagation();
120+
};
121+
const editShellClick = (event, item) => {
122+
emit('handleEditIcon', event, props.item);
123+
event.stopPropagation();
124+
};
125+
const itemShellClick = (event, item) => {
126+
emit('handleItemContent', event, props.item);
127+
event.stopPropagation();
128+
};
129+
130+
return {
131+
holddownstart,
132+
holddownmove,
133+
holddownend,
134+
showMaskRef,
135+
delClick,
136+
copyCLick,
137+
hideMaskClick,
138+
setDefault,
139+
maskClick,
140+
delShellClick,
141+
editShellClick,
142+
itemShellClick
143+
};
144+
}
145+
});
146+
</script>

0 commit comments

Comments
 (0)