Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

边框 #3

Merged
merged 1 commit into from
May 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/components/StyleParse/border/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup>
import { ref, watch } from "vue";
import { usePanel } from "@/hooks/usePanel";
let { current } = usePanel();
const init = current.value.styles?.border || null;
let val = ref(init);
watch(
() => val.value,
() => {
current.value["styles"]["border"] = val;
}
);
</script>
<template>
<el-input v-model="val" placeholder="1px solid red"></el-input>
</template>
<style scoped></style>
Empty file.
41 changes: 21 additions & 20 deletions src/components/StyleParse/colorPicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@ import { ref, watch } from "vue";
import { usePanel } from "@/hooks/usePanel";
let { current, isMenuDown } = usePanel();
const props = defineProps({
data: {
type: Object,
},
isStyle: {
type: Boolean,
default: false,
},
data: {
type: Object,
},
isStyle: {
type: Boolean,
default: false,
},
});
let key = props.data.key;
let init = current.value["styles"][key] || null;
let val = ref(init);
watch(
() => val.value,
() => {
if (props.isStyle) {
current.value["styles"][key] = val.value;
} else {
current[key] = val.value;
}
}
() => val.value,
() => {
if (props.isStyle) {
current.value["styles"][key] = val.value;
} else {
current[key] = val.value;
}
}
);
function md() {
isMenuDown.value = true;
isMenuDown.value = true;
}
function change() {
// isMenuDown.value = true;
// isMenuDown.value = true;
}
</script>

<template>
<div @mousedown.stop="md">
<el-color-picker v-model="val" @change="change" />
</div>
<div @mousedown.stop="md">
<el-color-picker v-model="val" @change="change" />
</div>
</template>

<style scoped></style>
17 changes: 9 additions & 8 deletions src/components/StyleParse/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Input from './input/index.vue';
import Echarts from './echarts/index.vue';
import InputNumber from './inputNumber/index.vue';
import ColorPicker from './colorPicker/index.vue';
import Input from "./input/index.vue";
import Echarts from "./echarts/index.vue";
import InputNumber from "./inputNumber/index.vue";
import ColorPicker from "./colorPicker/index.vue";
import Border from "./border/index.vue";


export default{
export default {
Input,
Echarts,
InputNumber,
ColorPicker
}
ColorPicker,
Border,
};
12 changes: 9 additions & 3 deletions src/components/custom/elementUi/button/index.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<script setup></script>
<script setup>
defineProps({
styles: Object,
value: String,
});
</script>

<template>
<div class="btn">
<el-button>hello</el-button>
<div class="btn" :style="{ ...styles }">
<el-button>{{ value }}</el-button>
</div>
</template>

Expand All @@ -14,5 +19,6 @@
::v-deep(.el-button) {
width: 100%;
height: 100%;
color: v-bind("styles.color");
}
</style>
3 changes: 2 additions & 1 deletion src/constants/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export const WIDGE_LIST = [
url: "/img/elementplus1.png",
component: "customElementUiButton",
label: "按钮",
value: "hello world!",
default: dft.ECHARTSPIE_DATA,
styles: dft.ECHARTSPIE_STYLE,
styleForm: styleFormConfig.PIE,
styleForm: styleFormConfig.BTN,
},
];
24 changes: 24 additions & 0 deletions src/constants/style-form-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export const TEXT = [
component: "InputNumber",
isStyle: true,
},
{
key: "border",
label: "边框",
component: "Border",
},
];

export const BAR = [
Expand Down Expand Up @@ -44,3 +49,22 @@ export const PIE = [
component: "el-input-number",
},
];

export const BTN = [
{
key: "color",
label: "颜色",
component: "ColorPicker",
isStyle: true,
},
{
key: "value",
label: "内容",
component: "Input",
},
{
key: "border",
label: "边框",
component: "Border",
},
];