mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 13:42:50 +00:00
优化
This commit is contained in:
parent
0c66ddc038
commit
30384e0b6a
@ -19,7 +19,7 @@ import { useFormat } from "./format";
|
||||
import { parsePx } from "/@/cool/utils";
|
||||
import { useTypes } from "./types";
|
||||
import { useCool } from "/@/cool";
|
||||
import { merge } from "lodash-es";
|
||||
import { isObject, merge } from "lodash-es";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: String,
|
||||
@ -61,10 +61,14 @@ function getContent() {
|
||||
}
|
||||
|
||||
// 设置内容
|
||||
function setContent(value?: string) {
|
||||
if (value != getContent()) {
|
||||
editor?.setValue(value || "");
|
||||
function setContent(value: string = "") {
|
||||
if (isObject(value)) {
|
||||
value = JSON.stringify(value);
|
||||
} else {
|
||||
value = value.toString();
|
||||
}
|
||||
|
||||
editor?.setValue(value);
|
||||
}
|
||||
|
||||
// 格式化内容
|
||||
@ -74,7 +78,7 @@ async function formatCode() {
|
||||
}
|
||||
|
||||
// 创建编辑器
|
||||
function init() {
|
||||
function create() {
|
||||
const options = merge(
|
||||
{
|
||||
theme: "default",
|
||||
@ -148,7 +152,7 @@ watch(
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
init();
|
||||
create();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user