-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
522 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<div style="display: flex; flex-direction: column;" class="v-x"> | ||
<div>w: <input :value="$attrs.w" @input="handleChange($event, 'w')"></div> | ||
<div>h: <input :value="$attrs.h" @input="handleChange($event, 'h')"></div> | ||
<div>x: <input :value="$attrs.x" @input="handleChange($event, 'x')"></div> | ||
<div>y: <input :value="$attrs.y" @input="handleChange($event, 'y')"></div> | ||
<div>z: <input :value="$attrs.z" @input="handleChange($event, 'z')"></div> | ||
<div>r: <input :value="$attrs.r" @input="handleChange($event, 'r')"></div> | ||
<div>name: <input :value="$attrs.name" @input="handleChange($event, 'name')"></div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
const emit = defineEmits(['change']); | ||
const handleChange = (e, key) => { | ||
emit('change', { [key]: e.target.value }); | ||
}; | ||
</script> | ||
|
||
<style lang="scss"> | ||
.v-x { | ||
input { | ||
margin: 10px; | ||
border: 1px solid #000; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
import Viewer from './viewer.vue'; | ||
import Editor from './editor.vue'; | ||
|
||
export const array = { | ||
module: "array", | ||
type: '营销', | ||
name: "数组模版", | ||
widgets: [ | ||
// 写法一 | ||
{ | ||
render() { | ||
return ( | ||
<div>一行两列</div> | ||
); | ||
} | ||
}, | ||
// 写法二 | ||
{ | ||
name: '一行两列', | ||
image: 'https://avatars3.githubusercontent.com/u/34465004?s=200&v=4', | ||
} | ||
], | ||
Viewer, | ||
Editor, | ||
// 初始数据 | ||
data: (index) => ({ | ||
// for draggable | ||
w: 200, | ||
h: 150, | ||
r: 0, | ||
x: 0, // 动态分配 | ||
y: 0, // 动态分配 | ||
z: 1, | ||
parent: false, | ||
// for frame | ||
closeable: true, | ||
|
||
// for content | ||
name: `名称${index}` | ||
}), | ||
dataValidity: (res = {}) => { | ||
if (!res.name) { | ||
return { | ||
error: "输入框内容必填" | ||
}; | ||
} | ||
return null; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<div :style="[{ height: `${h ? `${h}px` : 'auto' }`, width: `${w ? `${w}px` : 'auto' }`, color: 'black' }]"> | ||
id: {{ id }} <br> | ||
X: {{ x }} <br> | ||
Y: {{ y }} <br> | ||
Z: {{ z }} <br> | ||
Width: {{ w ? w : 'auto' }} <br> | ||
Height: {{ h ? h : 'auto' }} <br> | ||
Rotate: {{ r }} <br> | ||
Name: {{ name }} <br> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
defineProps({ | ||
vm: { | ||
type: Object, | ||
default: () => ({}) | ||
}, | ||
id: String, | ||
x: Number, | ||
y: Number, | ||
z: Number, | ||
w: Number, | ||
h: Number, | ||
r: Number, | ||
name: [Number, String] | ||
}); | ||
</script> | ||
|
||
<style lang="scss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<div style="display: flex; flex-direction: column;"> | ||
<div style="padding: 20px;"> | ||
<span>屏幕大小:</span> | ||
<InputNumber | ||
:model-value="$attrs.w" | ||
style="width: 88px; margin-right: 23px;" | ||
@input="e => handleChange(e, 'w')" | ||
/> | ||
<InputNumber | ||
v-model="$attrs.h" | ||
style="width: 88px;" | ||
@input="e => handleChange(e, 'h')" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { InputNumber } from '@wya/vc'; | ||
const emit = defineEmits(['change']); | ||
const handleChange = (v, key) => { | ||
emit('change', { [key]: v }); | ||
}; | ||
</script> | ||
|
||
<style lang="scss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Viewer from './viewer.vue'; | ||
import Editor from './editor.vue'; | ||
|
||
export const page = { | ||
module: "page", | ||
Viewer, | ||
Editor, | ||
// 初始数据 | ||
data: { | ||
name: '', | ||
|
||
w: window.screen.width, | ||
h: window.screen.height, | ||
parent: false, // 不能超过父级 | ||
// handles: [], // 可以控制操作handles | ||
draggable: false, // 可以拖拽 | ||
rotatable: false, // 可以旋转 | ||
resizable: false, // 可以变化 | ||
// for frame | ||
closeable: false, | ||
active: false, | ||
|
||
dragProps: { | ||
|
||
} | ||
}, | ||
dataValidity: (res = {}) => { | ||
if (!res.w && !res.h) { | ||
return { | ||
error: "输入框内容必填" | ||
}; | ||
} | ||
return null; | ||
} | ||
}; |
Oops, something went wrong.