Skip to content

Commit 9873a5c

Browse files
committed
Merge branch 'dev' into main
2 parents 5647303 + a83fc52 commit 9873a5c

File tree

7 files changed

+117
-20
lines changed

7 files changed

+117
-20
lines changed

packages/devui-vue/devui/avatar/src/components/icon-body.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { IconPropsType } from "../avatar-types";
1+
import type { IconPropsType } from '../avatar-types';
22

33
export const IconBody = (props: IconPropsType): JSX.Element => {
44
const { width, height } = props;
@@ -11,21 +11,15 @@ export const IconBody = (props: IconPropsType): JSX.Element => {
1111
}}
1212
viewBox="0 0 30 30"
1313
version="1.1"
14-
xmlns="http://www.w3.org/2000/svg"
15-
>
16-
<g
17-
id="未命名"
18-
stroke="none"
19-
stroke-width="1"
20-
fill="none"
21-
fill-rule="evenodd"
22-
>
14+
xmlns="http://www.w3.org/2000/svg">
15+
<g id="未命名" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
2316
<circle id="Oval" fill="#CACFD8" cx="15" cy="15" r="15"></circle>
2417
<path
25-
d="M14.9997866,16 C12.5145053,16 10.4997866,13.9852814 10.4997866, 11.5 C10.4997866,9.01471863 12.5145053,7 14.9997866,7 C17.485068, 7 19.4997866,9.01471863 19.4997866,11.5 C19.4997866,13.9852814 17.485068, 16 14.9997866,16 Z M23,23 L7,22.998553 C7,19.0122153 10.8892296, 16.5 14.9997866,16.5 C19.1103437,16.5 23,20 23,23 Z"
18+
d={`M14.9997866,16 C12.5145053,16 10.4997866,13.9852814 10.4997866, 11.5 C10.4997866,9.01471863 12.5145053,7 14.9997866,7
19+
C17.485068, 7 19.4997866,9.01471863 19.4997866,11.5 C19.4997866,13.9852814 17.485068, 16 14.9997866,16 Z M23,23 L7,22.998553
20+
C7,19.0122153 10.8892296, 16.5 14.9997866,16.5 C19.1103437,16.5 23,20 23,23 Z`}
2621
id="形状结合"
27-
fill="#FFFFFF"
28-
></path>
22+
fill="#FFFFFF"></path>
2923
</g>
3024
</svg>
3125
);

packages/devui-vue/devui/avatar/src/components/icon-nobody.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ export const IconNobody = (props: IconPropsType): JSX.Element => {
1414
xmlns="http://www.w3.org/2000/svg">
1515
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
1616
<path
17-
d="M22.31,19.2474562 L22.31,21.9974562 L20.81,21.9974562 L20.81, 19.2474562 L18.06,19.2474562 L18.06,17.7474562 L20.81,17.7474562 L20.81, 14.9974562 L22.31,14.9974562 L22.31,17.7474562 L25.06,17.7474562 L25.06, 19.2474562 L22.31,19.2474562 Z M14.9297866,14.9974562 C12.4445053, 14.9974562 10.4297866,12.9827376 10.4297866,10.4974562 C10.4297866, 8.01217483 12.4445053,5.9974562 14.9297866,5.9974562 C17.415068, 5.9974562 19.4297866,8.01217483 19.4297866,10.4974562 C19.4297866, 12.9827376 17.415068,14.9974562 14.9297866,14.9974562 Z M19.6797866, 20.2474562 L19.6797866,21.9971623 L6.93,21.9960092 C6.93,18.0096715 10.8192296, 15.4974562 14.9297866,15.4974562 C16.4608397,15.4974562 17.9612467,15.983021 19.2414296, 16.7474562 L17.06,16.7474562 L17.06,20.2474562 L19.6797866,20.2474562 Z"
17+
d={`M22.31,19.2474562 L22.31,21.9974562 L20.81,21.9974562 L20.81, 19.2474562 L18.06,19.2474562 L18.06,17.7474562
18+
L20.81,17.7474562 L20.81, 14.9974562 L22.31,14.9974562 L22.31,17.7474562 L25.06,17.7474562 L25.06, 19.2474562
19+
L22.31,19.2474562 Z M14.9297866,14.9974562 C12.4445053, 14.9974562 10.4297866,12.9827376 10.4297866,10.4974562
20+
C10.4297866, 8.01217483 12.4445053,5.9974562 14.9297866,5.9974562 C17.415068, 5.9974562 19.4297866,8.01217483
21+
19.4297866,10.4974562 C19.4297866, 12.9827376 17.415068,14.9974562 14.9297866,14.9974562 Z M19.6797866, 20.2474562
22+
L19.6797866,21.9971623 L6.93,21.9960092 C6.93,18.0096715 10.8192296, 15.4974562 14.9297866,15.4974562 C16.4608397,15.4974562
23+
17.9612467,15.983021 19.2414296, 16.7474562 L17.06,16.7474562 L17.06,20.2474562 L19.6797866,20.2474562 Z`}
1824
id="形状结合"
1925
fill="#959EB2"></path>
2026
<path

packages/devui-vue/devui/code-editor/src/code-editor-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface Comment {
1515
domNode?: HTMLElement;
1616
heightInPx?: number;
1717
allowEditorOverflow?: boolean;
18-
offserLeft?: number;
18+
offsetLeft?: number;
1919
}
2020

2121
export const codeEditorProps = {

packages/devui-vue/devui/code-editor/src/code-editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import './code-editor.scss'
77
export default defineComponent({
88
name: 'DCodeEditor',
99
props: codeEditorProps,
10-
emits: ['update: modelValue', 'afterEditorInit', 'click'],
11-
setup(props: codeEditorProps, ctx: SetupContext) {
10+
emits: ['update:modelValue', 'afterEditorInit', 'click'],
11+
setup(props: CodeEditorProps, ctx: SetupContext) {
1212
const { editorEl } = useCodeEditor(props, ctx);
1313

1414
return () => <div ref={editorEl} class="devui-code-editor"></div>

packages/devui-vue/devui/code-editor/src/composables/use-code-editor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ export function useCodeEditor(props: CodeEditorProps, ctx: SetupContext) {
178178
model = diffEditor.getModel().modified;
179179
}
180180

181-
model.onDidChangeContent(
181+
model?.onDidChangeContent(
182182
throttle(() => {
183183
modifyValueFromInner = true;
184-
ctx.emit('update: modelValue', model.getValue());
184+
ctx.emit('update:modelValue', model.getValue());
185185
}, 100)
186186
);
187187
}

packages/devui-vue/docs/components/upload/index.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,103 @@ export default {
341341

342342
:::
343343

344+
### 图片上传示例
345+
346+
:::demo
347+
348+
```vue
349+
<template>
350+
<div class="img-container" v-if="!showUpload">
351+
<img class="img-preview" />
352+
<div class="delete-img" @click="handleDel">
353+
<d-icon name="delete" size="14px"></d-icon>
354+
</div>
355+
</div>
356+
<d-upload class="upload-demo-new" accept=".png" :upload-options="uploadOptions" :before-upload="beforeUpload" v-if="showUpload">
357+
<div class="upload-trigger">
358+
<d-icon name="add" size="24px"></d-icon>
359+
</div>
360+
</d-upload>
361+
</template>
362+
<script>
363+
import { ref, watch, nextTick } from 'vue';
364+
365+
export default {
366+
setup() {
367+
const showUpload = ref(true);
368+
const uploadOptions = ref({
369+
uri: 'https://run.mocky.io/v3/132b3ea3-23ea-436b-aed4-c43ef9d116f0',
370+
});
371+
372+
const beforeUpload = (file) => {
373+
const reader = new FileReader();
374+
reader.onload = async () => {
375+
showUpload.value = false;
376+
await nextTick();
377+
document.getElementsByClassName('img-preview')[0].src = reader.result;
378+
};
379+
reader.readAsDataURL(file[0].file);
380+
return false;
381+
};
382+
383+
const handleDel = () => {
384+
showUpload.value = true;
385+
};
386+
387+
return {
388+
uploadOptions,
389+
beforeUpload,
390+
showUpload,
391+
handleDel,
392+
};
393+
},
394+
};
395+
</script>
396+
397+
<style>
398+
.upload-demo-new .upload-trigger {
399+
background-color: #fff;
400+
border: 1px dashed #d9d9d9;
401+
border-radius: 6px;
402+
box-sizing: border-box;
403+
width: 180px;
404+
height: 180px;
405+
text-align: center;
406+
cursor: pointer;
407+
position: relative;
408+
overflow: hidden;
409+
display: flex;
410+
flex-direction: column;
411+
justify-content: center;
412+
}
413+
.upload-demo .upload-trigger .link {
414+
color: #5e7ce0;
415+
}
416+
.img-container {
417+
position: relative;
418+
}
419+
.img-preview {
420+
width: 180px;
421+
height: 180px;
422+
border-radius: 6px;
423+
}
424+
.delete-img {
425+
width: 24px;
426+
height: 24px;
427+
background-color: #f7f7f9;
428+
border-radius: 50%;
429+
display: flex;
430+
justify-content: center;
431+
align-items: center;
432+
position: absolute;
433+
top: -12px;
434+
left: 168px;
435+
}
436+
</style>
437+
```
438+
439+
:::
440+
344441
### Upload 参数
345442

346443
| 参数名 | 类型 | 默认 | 说明 | 跳转 Demo |

packages/devui-vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-devui",
3-
"version": "1.5.7-hotfix.2",
3+
"version": "1.5.7-hotfix.3",
44
"license": "MIT",
55
"description": "DevUI components based on Vite and Vue3",
66
"keywords": [

0 commit comments

Comments
 (0)