Skip to content

Commit

Permalink
feat(属性): 关联字段
Browse files Browse the repository at this point in the history
  • Loading branch information
nihaojob committed Mar 5, 2024
1 parent e94745c commit cfb4cff
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 26 deletions.
25 changes: 25 additions & 0 deletions src/components/attribute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,29 @@
</div>
</div>
</div>
<!-- 关联数据 -->
<div class="flex-view">
<div class="flex-item">
<span class="label">{{ $t('attributes.linkData') }}</span>
<div class="content slider-box">
<!-- <Input v-model="baseAttr.linkData" @on-change="changeCommon('id', baseAttr.id)"></Input> -->
<Select
v-model="baseAttr.linkData"
filterable
multiple
allow-create
@on-change="changeCommon('linkData', baseAttr.linkData)"
>
<Option value="src"></Option>
<Option value="text"></Option>
<Option value="名称"></Option>
<Option value="照片"></Option>
<Option value="日期"></Option>
<Option value="描述"></Option>
</Select>
</div>
</div>
</div>
</div>
</div>
</template>
Expand Down Expand Up @@ -328,6 +351,7 @@ const baseAttr = reactive({
offsetY: 0,
},
points: {},
linkData: null,
});
// 字体属性
const fontAttr = reactive({
Expand Down Expand Up @@ -453,6 +477,7 @@ const getObjectAttr = (e) => {
baseAttr.shadow = activeObject.get('shadow') || {};
baseAttr.angle = activeObject.get('angle') || 0;
baseAttr.points = activeObject.get('points') || {};
baseAttr.linkData = activeObject.get('linkData') || null;
const textTypes = ['i-text', 'text', 'textbox'];
if (textTypes.includes(activeObject.type)) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/ServersPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: 秦少卫
* @Date: 2023-06-20 12:52:09
* @LastEditors: 秦少卫
* @LastEditTime: 2024-02-06 18:46:28
* @LastEditTime: 2024-03-05 22:02:19
* @Description: 内部插件
*/
import { v4 as uuid } from 'uuid';
Expand Down Expand Up @@ -81,7 +81,7 @@ class ServersPlugin {
}

getJson() {
return this.canvas.toJSON(['id', 'gradientAngle', 'selectable', 'hasControls']);
return this.canvas.toJSON(['id', 'gradientAngle', 'selectable', 'hasControls', 'linkData']);
}

/**
Expand Down
25 changes: 13 additions & 12 deletions src/language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
"text": "WaterMark",
"modalTitle": "WaterMark Setting",
"setting": {
"name": "Mark Name",
"size": "MarK Size",
"angle": "Mark Angle",
"position": {
"label": "Mark Position",
"lt": "Left Top",
"rt": "Right Top",
"lb": "Left Bottom",
"rb": "Right Bottom",
"full": "Full"
}
"name": "Mark Name",
"size": "MarK Size",
"angle": "Mark Angle",
"position": {
"label": "Mark Position",
"lt": "Left Top",
"rt": "Right Top",
"lb": "Left Bottom",
"rb": "Right Bottom",
"full": "Full"
}
}
},
"material": {
Expand Down Expand Up @@ -158,6 +158,7 @@
"phone_wallpaper": "Phone Wallpaper",
"attributes": {
"id": "ID",
"linkData": "linkData",
"font": "Font",
"align": "Align",
"bold": "Bold:",
Expand All @@ -183,4 +184,4 @@
"replaceTip": "Are you sure you want to add to the canvas?",
"ok": "ok",
"cancel": "cancel"
}
}
25 changes: 13 additions & 12 deletions src/language/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
"text": "水印",
"modalTitle": "配置水印",
"setting": {
"name": "水印名称",
"size": "水印大小",
"angle": "水印角度",
"position": {
"label": "水印位置",
"lt": "左上角",
"rt": "右上角",
"lb": "左下角",
"rb": "右下角",
"full": "平铺"
}
"name": "水印名称",
"size": "水印大小",
"angle": "水印角度",
"position": {
"label": "水印位置",
"lt": "左上角",
"rt": "右上角",
"lb": "左下角",
"rb": "右下角",
"full": "平铺"
}
}
},
"material": {
Expand Down Expand Up @@ -147,6 +147,7 @@
"phone_wallpaper": "手机壁纸",
"attributes": {
"id": "标识",
"linkData": "关联数据",
"font": "字体",
"align": "对齐",
"bold": "加粗:",
Expand All @@ -172,4 +173,4 @@
"replaceTip": "确定要添加到画布中吗?",
"ok": "确认",
"cancel": "取消"
}
}

0 comments on commit cfb4cff

Please sign in to comment.