|
@@ -1,16 +1,34 @@
|
|
|
<template>
|
|
|
<div class="font-style">
|
|
|
- <span class="cus-btn" :class="{'active-btn': bold}"><BoldOutlined @click="handleBold"/></span>
|
|
|
- <span class="cus-btn" :class="{'active-btn': italic}"><ItalicOutlined @click="handleItalic"/></span>
|
|
|
- <span class="cus-btn" :class="{'active-btn': underline}"><UnderlineOutlined @click="handleUnderline"/></span>
|
|
|
- <InputNumber size="small" min={1} max={100} step={1} precision={0} style="width: 80px" @change="handleChange"/>
|
|
|
+ <span class="cus-btn" :class="{ 'active-btn': bold }"
|
|
|
+ ><BoldOutlined @click="handleBold"
|
|
|
+ /></span>
|
|
|
+ <span class="cus-btn" :class="{ 'active-btn': italic }"
|
|
|
+ ><ItalicOutlined @click="handleItalic"
|
|
|
+ /></span>
|
|
|
+ <span class="cus-btn" :class="{ 'active-btn': underline }"
|
|
|
+ ><UnderlineOutlined @click="handleUnderline"
|
|
|
+ /></span>
|
|
|
+ <InputNumber
|
|
|
+ size="small"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ :step="1"
|
|
|
+ :precision="0"
|
|
|
+ style="width: 80px"
|
|
|
+ @change="handleChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { defineProps, defineEmits, ref } from 'vue';
|
|
|
-import { BoldOutlined, ItalicOutlined, UnderlineOutlined, } from '@ant-design/icons-vue';
|
|
|
-import { InputNumber } from 'ant-design-vue';
|
|
|
+import { defineProps, defineEmits, ref } from "vue";
|
|
|
+import {
|
|
|
+ BoldOutlined,
|
|
|
+ ItalicOutlined,
|
|
|
+ UnderlineOutlined,
|
|
|
+} from "@ant-design/icons-vue";
|
|
|
+import { InputNumber } from "ant-design-vue";
|
|
|
|
|
|
const props = defineProps<{
|
|
|
value: number;
|
|
@@ -19,7 +37,12 @@ const props = defineProps<{
|
|
|
underline: boolean;
|
|
|
}>();
|
|
|
|
|
|
-const emit = defineEmits(["update:value", "update:bold", "update:italic", "update:underline"]);
|
|
|
+const emit = defineEmits([
|
|
|
+ "update:value",
|
|
|
+ "update:bold",
|
|
|
+ "update:italic",
|
|
|
+ "update:underline",
|
|
|
+]);
|
|
|
|
|
|
const bold = ref(props.bold);
|
|
|
const italic = ref(props.italic);
|
|
@@ -28,19 +51,19 @@ const value = ref(props.value);
|
|
|
|
|
|
const handleBold = () => {
|
|
|
bold.value = !bold.value;
|
|
|
- emit('update:bold', bold.value);
|
|
|
+ emit("update:bold", bold.value);
|
|
|
};
|
|
|
const handleItalic = () => {
|
|
|
italic.value = !italic.value;
|
|
|
- emit('update:italic', italic.value);
|
|
|
+ emit("update:italic", italic.value);
|
|
|
};
|
|
|
const handleUnderline = () => {
|
|
|
underline.value = !underline.value;
|
|
|
- emit('update:underline', underline.value);
|
|
|
+ emit("update:underline", underline.value);
|
|
|
};
|
|
|
const handleChange = (e: any) => {
|
|
|
value.value = e.target.value;
|
|
|
- emit('update:value', value.value);
|
|
|
+ emit("update:value", value.value);
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -52,4 +75,4 @@ const handleChange = (e: any) => {
|
|
|
.active-btn {
|
|
|
color: @primary-color;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|