Skip to content

Commit

Permalink
边框
Browse files Browse the repository at this point in the history
  • Loading branch information
Betty985 committed May 7, 2022
1 parent a37f0e0 commit f2ab32a
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 32 deletions.
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",
},
];

0 comments on commit f2ab32a

Please sign in to comment.