删除status字段
This commit is contained in:
@@ -19,7 +19,6 @@ import MaResourceButton from "./ma-resource/button.vue"
|
||||
import MaUser from "./ma-user/index.vue"
|
||||
import MaEditor from "./ma-editor/index.vue"
|
||||
import MaIcon from "./ma-icon/index.vue"
|
||||
import MaCodeEditor from "./ma-codeEditor/index.vue"
|
||||
import MaUserInfo from "./ma-userInfo/index.vue"
|
||||
import MaCityLinkage from "./ma-cityLinkage/index.vue"
|
||||
// 后续增加的全局组件
|
||||
@@ -51,7 +50,6 @@ export default {
|
||||
Vue.component("MaUser", MaUser)
|
||||
Vue.component("MaEditor", MaEditor)
|
||||
Vue.component("MaIcon", MaIcon)
|
||||
Vue.component("MaCodeEditor", MaCodeEditor)
|
||||
Vue.component("MaUserInfo", MaUserInfo)
|
||||
Vue.component("MaCityLinkage", MaCityLinkage)
|
||||
// 后续增加的组件
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
<template>
|
||||
<div class="editor" ref="dom" :style="'width: 100%; height: ' + props.height + 'px'"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from "vue"
|
||||
import { useAppStore } from "@/store"
|
||||
import { formatJson } from "@/utils/common"
|
||||
import * as monaco from "monaco-editor/esm/vs/editor/editor.api"
|
||||
import "monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution"
|
||||
import "monaco-editor/esm/vs/basic-languages/php/php.contribution"
|
||||
import "monaco-editor/esm/vs/basic-languages/mysql/mysql.contribution"
|
||||
import "monaco-editor/esm/vs/basic-languages/html/html.contribution"
|
||||
import "monaco-editor/esm/vs/basic-languages/css/css.contribution"
|
||||
import "monaco-editor/esm/vs/editor/contrib/find/browser/findController"
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [String, Object, Array],
|
||||
default: () => ""
|
||||
},
|
||||
isBind: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 400
|
||||
},
|
||||
language: {
|
||||
type: String,
|
||||
default: "javascript"
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(["update:modelValue"])
|
||||
const dom = ref()
|
||||
|
||||
let instance
|
||||
|
||||
onMounted(() => {
|
||||
instance = monaco.editor.create(dom.value, {
|
||||
value: typeof props.modelValue === "string" ? props.modelValue : formatJson(props.modelValue),
|
||||
tabSize: 2,
|
||||
automaticLayout: true,
|
||||
scrollBeyondLastLine: false,
|
||||
language: props.language,
|
||||
theme: appStore.mode === "light" ? "vs" : "vs-dark",
|
||||
autoIndent: true,
|
||||
minimap: { enabled: false },
|
||||
readOnly: props.readonly,
|
||||
folding: true,
|
||||
acceptSuggestionOnCommitCharacter: true,
|
||||
acceptSuggestionOnEnter: true,
|
||||
contextmenu: true
|
||||
})
|
||||
|
||||
instance.onDidChangeModelContent(() => {
|
||||
emit("update:modelValue", instance.getValue())
|
||||
})
|
||||
})
|
||||
|
||||
if (props.isBind) {
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(vl) => instance.setValue(typeof vl === "string" ? vl : formatJson(vl))
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.editor {
|
||||
border: 1px solid var(--color-border-2);
|
||||
border-radius: 1px;
|
||||
background: var(--color-bg-2);
|
||||
}
|
||||
</style>
|
||||
@@ -1,62 +0,0 @@
|
||||
<!--
|
||||
- MineAdmin is committed to providing solutions for quickly building web applications
|
||||
- Please view the LICENSE file that was distributed with this source code,
|
||||
- For the full copyright and license information.
|
||||
- Thank you very much for using MineAdmin.
|
||||
-
|
||||
- @Author X.Mo<root@imoi.cn>
|
||||
- @Link https://gitee.com/xmo/mineadmin-vue
|
||||
-->
|
||||
<template>
|
||||
<ma-form-item
|
||||
v-if="typeof props.component.display == 'undefined' || props.component.display === true"
|
||||
:component="props.component"
|
||||
:custom-field="props.customField"
|
||||
>
|
||||
<slot :name="`form-${props.component.dataIndex}`" v-bind="props.component">
|
||||
<ma-code-editor
|
||||
v-model="value"
|
||||
style="width: 100%"
|
||||
:height="props.component.height"
|
||||
:isBind="props.component.isBind"
|
||||
:language="props.component.language"
|
||||
:readonly="props.component.readonly"
|
||||
@change="maEvent.handleChangeEvent(props.component, $event)"
|
||||
>
|
||||
</ma-code-editor>
|
||||
</slot>
|
||||
</ma-form-item>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, inject, onMounted, watch } from "vue"
|
||||
import { get, set } from "lodash"
|
||||
import MaCodeEditor from "@/components/ma-codeEditor/index.vue"
|
||||
import MaFormItem from "./form-item.vue"
|
||||
import { maEvent } from "../js/formItemMixin.js"
|
||||
const props = defineProps({
|
||||
component: Object,
|
||||
customField: { type: String, default: undefined }
|
||||
})
|
||||
|
||||
const formModel = inject("formModel")
|
||||
const index = props.customField ?? props.component.dataIndex
|
||||
const value = ref(get(formModel.value, index))
|
||||
|
||||
watch(
|
||||
() => get(formModel.value, index),
|
||||
(vl) => (value.value = vl)
|
||||
)
|
||||
watch(
|
||||
() => value.value,
|
||||
(v) => {
|
||||
set(formModel.value, index, v)
|
||||
index.indexOf(".") > -1 && delete formModel.value[index]
|
||||
}
|
||||
)
|
||||
|
||||
maEvent.handleCommonEvent(props.component, "onCreated")
|
||||
onMounted(() => {
|
||||
maEvent.handleCommonEvent(props.component, "onMounted")
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user