提交 09aaaede authored 作者: junjie's avatar junjie

fix:代码规范

上级 076a66ed
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<div ref="rightPanel" :class="{show:show}" class="rightPanel-container"> <div ref="rightPanel" :class="{show:show}" class="rightPanel-container">
<div class="rightPanel-background" /> <div class="rightPanel-background" />
<div class="rightPanel"> <div class="rightPanel">
<!-- <div class="handle-button" :style="{'top':buttonTop+'px','background-color':theme}" @click="show=!show">--> <!-- <div class="handle-button" :style="{'top':buttonTop+'px','background-color':theme}" @click="show=!show">-->
<!-- <i :class="show?'el-icon-close':'el-icon-setting'" />--> <!-- <i :class="show?'el-icon-close':'el-icon-setting'" />-->
<!-- </div>--> <!-- </div>-->
<div class="rightPanel-items"> <div class="rightPanel-items">
<slot /> <slot />
</div> </div>
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
<el-tab-pane v-for="item in animationClassData" :key="item.label" :label="item.label" :name="item.label"> <el-tab-pane v-for="item in animationClassData" :key="item.label" :label="item.label" :name="item.label">
<el-scrollbar class="animate-container"> <el-scrollbar class="animate-container">
<div <div
class="animate"
v-for="(animate, index) in item.children" v-for="(animate, index) in item.children"
:key="index" :key="index"
class="animate"
@mouseover="hoverPreviewAnimate = animate.value" @mouseover="hoverPreviewAnimate = animate.value"
@click="addAnimation(animate)" @click="addAnimation(animate)"
> >
...@@ -52,11 +52,11 @@ export default { ...@@ -52,11 +52,11 @@ export default {
hoverPreviewAnimate: '', hoverPreviewAnimate: '',
animationActiveName: '进入', animationActiveName: '进入',
animationClassData, animationClassData,
showAnimatePanel: false, showAnimatePanel: false
} }
}, },
computed: mapState([ computed: mapState([
'curComponent', 'curComponent'
]), ]),
methods: { methods: {
addAnimation(animate) { addAnimation(animate) {
...@@ -70,8 +70,8 @@ export default { ...@@ -70,8 +70,8 @@ export default {
removeAnimation(index) { removeAnimation(index) {
this.$store.commit('removeAnimation', index) this.$store.commit('removeAnimation', index)
}, }
}, }
} }
</script> </script>
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
bus.$emit('component-dialog-edit') bus.$emit('component-dialog-edit')
} }
//编辑样式组件 // 编辑样式组件
if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') { if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') {
bus.$emit('component-dialog-style') bus.$emit('component-dialog-style')
......
...@@ -39,11 +39,11 @@ export default { ...@@ -39,11 +39,11 @@ export default {
isShowEvent: false, isShowEvent: false,
eventURL: '', eventURL: '',
eventActiveName: 'redirect', eventActiveName: 'redirect',
eventList, eventList
} }
}, },
computed: mapState([ computed: mapState([
'curComponent', 'curComponent'
]), ]),
methods: { methods: {
addEvent(event, param) { addEvent(event, param) {
...@@ -53,8 +53,8 @@ export default { ...@@ -53,8 +53,8 @@ export default {
removeEvent(event) { removeEvent(event) {
this.$store.commit('removeEvent', event) this.$store.commit('removeEvent', event)
}, }
}, }
} }
</script> </script>
......
<template> <template>
<div class="modal-bg" v-if="show" @click="hide"> <div v-if="show" class="modal-bg" @click="hide">
<div class="fadeInLeft animated modal" @click="stopPropagation"> <div class="fadeInLeft animated modal" @click="stopPropagation">
<slot></slot> <slot />
</div> </div>
</div> </div>
</template> </template>
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
export default { export default {
model: { model: {
prop: 'show', prop: 'show',
event: 'change', event: 'change'
}, },
props: { props: {
show: { show: {
type: Boolean, type: Boolean,
default: false, default: false
}, }
}, },
methods: { methods: {
hide() { hide() {
...@@ -25,8 +25,8 @@ export default { ...@@ -25,8 +25,8 @@ export default {
stopPropagation(e) { stopPropagation(e) {
e.stopPropagation() e.stopPropagation()
}, }
}, }
} }
</script> </script>
......
...@@ -9,9 +9,9 @@ export default { ...@@ -9,9 +9,9 @@ export default {
props: { props: {
propValue: { propValue: {
type: String, type: String,
require: true, require: true
}, }
}, }
} }
</script> </script>
......
...@@ -7,9 +7,9 @@ export default { ...@@ -7,9 +7,9 @@ export default {
props: { props: {
propValue: { propValue: {
type: String, type: String,
default: '', default: ''
}, }
}, }
} }
</script> </script>
......
...@@ -6,6 +6,6 @@ export default { ...@@ -6,6 +6,6 @@ export default {
removeAnimation({ curComponent }, index) { removeAnimation({ curComponent }, index) {
curComponent.animations.splice(index, 1) curComponent.animations.splice(index, 1)
}, }
}, }
} }
...@@ -2,7 +2,7 @@ export default { ...@@ -2,7 +2,7 @@ export default {
state: { state: {
menuTop: 0, // 右击菜单数据 menuTop: 0, // 右击菜单数据
menuLeft: 0, menuLeft: 0,
menuShow: false, menuShow: false
}, },
mutations: { mutations: {
showContextMenu(state, { top, left }) { showContextMenu(state, { top, left }) {
...@@ -13,6 +13,6 @@ export default { ...@@ -13,6 +13,6 @@ export default {
hideContextMenu(state) { hideContextMenu(state) {
state.menuShow = false state.menuShow = false
}, }
}, }
} }
...@@ -6,6 +6,6 @@ export default { ...@@ -6,6 +6,6 @@ export default {
removeEvent({ curComponent }, event) { removeEvent({ curComponent }, event) {
delete curComponent.events[event] delete curComponent.events[event]
}, }
}, }
} }
...@@ -6,6 +6,6 @@ export default { ...@@ -6,6 +6,6 @@ export default {
unlock({ curComponent }) { unlock({ curComponent }) {
curComponent.isLock = false curComponent.isLock = false
}, }
}, }
} }
...@@ -37,8 +37,8 @@ export default [ ...@@ -37,8 +37,8 @@ export default [
{ label: '向右滑动展开', value: 'slideInLeft' }, { label: '向右滑动展开', value: 'slideInLeft' },
{ label: '向左滑动展开', value: 'slideInRight' }, { label: '向左滑动展开', value: 'slideInRight' },
{ label: '向上滑动展开', value: 'slideInUp' }, { label: '向上滑动展开', value: 'slideInUp' },
{ label: '向下滑动展开', value: 'slideInDown' }, { label: '向下滑动展开', value: 'slideInDown' }
], ]
}, },
{ {
label: '强调', label: '强调',
...@@ -52,8 +52,8 @@ export default [ ...@@ -52,8 +52,8 @@ export default [
{ label: '放大晃动缩小', value: 'tada' }, { label: '放大晃动缩小', value: 'tada' },
{ label: '扇形摇摆', value: 'wobble' }, { label: '扇形摇摆', value: 'wobble' },
{ label: '左右上下晃动', value: 'jello' }, { label: '左右上下晃动', value: 'jello' },
{ label: 'Y轴旋转', value: 'flip' }, { label: 'Y轴旋转', value: 'flip' }
], ]
}, },
{ {
label: '退出', label: '退出',
...@@ -88,7 +88,7 @@ export default [ ...@@ -88,7 +88,7 @@ export default [
{ label: '向左滑动收起', value: 'slideOutLeft' }, { label: '向左滑动收起', value: 'slideOutLeft' },
{ label: '向右滑动收起', value: 'slideOutRight' }, { label: '向右滑动收起', value: 'slideOutRight' },
{ label: '向上滑动收起', value: 'slideOutUp' }, { label: '向上滑动收起', value: 'slideOutUp' },
{ label: '向下滑动收起', value: 'slideOutDown' }, { label: '向下滑动收起', value: 'slideOutDown' }
], ]
}, }
] ]
...@@ -7,7 +7,7 @@ export default function decomposeComponent(component, editorRect, parentStyle) { ...@@ -7,7 +7,7 @@ export default function decomposeComponent(component, editorRect, parentStyle) {
// 获取元素的中心点坐标 // 获取元素的中心点坐标
const center = { const center = {
x: componentRect.left - editorRect.left + componentRect.width / 2, x: componentRect.left - editorRect.left + componentRect.width / 2,
y: componentRect.top - editorRect.top + componentRect.height / 2, y: componentRect.top - editorRect.top + componentRect.height / 2
} }
component.style.rotate = mod360(component.style.rotate + parentStyle.rotate) component.style.rotate = mod360(component.style.rotate + parentStyle.rotate)
......
...@@ -10,11 +10,11 @@ const events = { ...@@ -10,11 +10,11 @@ const events = {
if (msg) { if (msg) {
alert(msg) alert(msg)
} }
}, }
} }
const mixins = { const mixins = {
methods: events, methods: events
} }
const eventList = [ const eventList = [
...@@ -22,18 +22,18 @@ const eventList = [ ...@@ -22,18 +22,18 @@ const eventList = [
key: 'redirect', key: 'redirect',
label: '跳转事件', label: '跳转事件',
event: events.redirect, event: events.redirect,
param: '', param: ''
}, },
{ {
key: 'alert', key: 'alert',
label: 'alert 事件', label: 'alert 事件',
event: events.alert, event: events.alert,
param: '', param: ''
}, }
] ]
export { export {
mixins, mixins,
events, events,
eventList, eventList
} }
import store from '@/store' import store from '@/store'
import eventBus from '@/components/canvas/utils/eventBus' import eventBus from '@/components/canvas/utils/eventBus'
const ctrlKey = 17, const ctrlKey = 17
vKey = 86, // 粘贴 const vKey = 86 // 粘贴
cKey = 67, // 复制 const cKey = 67 // 复制
xKey = 88, // 剪切 const xKey = 88 // 剪切
yKey = 89, // 重做 const yKey = 89 // 重做
zKey = 90, // 撤销 const zKey = 90 // 撤销
gKey = 71, // 组合 const gKey = 71 // 组合
bKey = 66, // 拆分 const bKey = 66 // 拆分
lKey = 76, // 锁定 const lKey = 76 // 锁定
uKey = 85, // 解锁 const uKey = 85 // 解锁
sKey = 83, // 保存 const sKey = 83 // 保存
pKey = 80, // 预览 const pKey = 80 // 预览
dKey = 68, // 删除 const dKey = 68 // 删除
deleteKey = 46, // 删除 const deleteKey = 46 // 删除
eKey = 69 // 清空画布 const eKey = 69 // 清空画布
export const keycodes = [66, 67, 68, 69, 71, 76, 80, 83, 85, 86, 88, 89, 90] export const keycodes = [66, 67, 68, 69, 71, 76, 80, 83, 85, 86, 88, 89, 90]
...@@ -30,13 +30,13 @@ const basemap = { ...@@ -30,13 +30,13 @@ const basemap = {
[zKey]: undo, [zKey]: undo,
[sKey]: save, [sKey]: save,
[pKey]: preview, [pKey]: preview,
[eKey]: clearCanvas, [eKey]: clearCanvas
} }
// 组件锁定状态下可以执行的操作 // 组件锁定状态下可以执行的操作
const lockMap = { const lockMap = {
...basemap, ...basemap,
[uKey]: unlock, [uKey]: unlock
} }
// 组件未锁定状态下可以执行的操作 // 组件未锁定状态下可以执行的操作
...@@ -48,7 +48,7 @@ const unlockMap = { ...@@ -48,7 +48,7 @@ const unlockMap = {
[bKey]: decompose, [bKey]: decompose,
[dKey]: deleteComponent, [dKey]: deleteComponent,
[deleteKey]: deleteComponent, [deleteKey]: deleteComponent,
[lKey]: lock, [lKey]: lock
} }
let isCtrlDown = false let isCtrlDown = false
......
...@@ -4,6 +4,6 @@ export default function toast(message = '', type = 'error', duration = 1500) { ...@@ -4,6 +4,6 @@ export default function toast(message = '', type = 'error', duration = 1500) {
Message({ Message({
message, message,
type, type,
duration, duration
}) })
} }
export function deepCopy(target) { export function deepCopy(target) {
if (typeof target == 'object') { if (typeof target === 'object') {
const result = Array.isArray(target)? [] : {} const result = Array.isArray(target) ? [] : {}
for (const key in target) { for (const key in target) {
if (typeof target[key] == 'object') { if (typeof target[key] === 'object') {
result[key] = deepCopy(target[key]) result[key] = deepCopy(target[key])
} else { } else {
result[key] = target[key] result[key] = target[key]
......
...@@ -80,7 +80,7 @@ export default { ...@@ -80,7 +80,7 @@ export default {
background: '0% 0% / cover rgb(239, 241, 244)' background: '0% 0% / cover rgb(239, 241, 244)'
} }
if (this.subjectItemDetails) { if (this.subjectItemDetails) {
if (this.subjectItemDetails.panel.backgroundType === 'image'&&this.subjectItemDetails.panel.imageUrl) { if (this.subjectItemDetails.panel.backgroundType === 'image' && this.subjectItemDetails.panel.imageUrl) {
style = { style = {
width: '100%', width: '100%',
height: '100%', height: '100%',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论