This commit is contained in:
神仙都没用 2024-02-28 11:41:53 +08:00
parent 5219edd281
commit 9919390e32
5 changed files with 553 additions and 528 deletions

View File

@ -1,6 +1,7 @@
export const proxy = { export const proxy = {
"/dev/": { "/dev/": {
target: "http://127.0.0.1:8001", target: "https://test-admin.cool-js.cloud",
// target: "http://127.0.0.1:8001",
changeOrigin: true, changeOrigin: true,
rewrite: (path: string) => path.replace(/^\/dev/, "") rewrite: (path: string) => path.replace(/^\/dev/, "")
}, },

View File

@ -1,4 +1,4 @@
import * as mqtt from "mqtt/dist/mqtt.min"; import mqtt from "mqtt/dist/mqtt.min";
import { useCool } from "/@/cool"; import { useCool } from "/@/cool";
let client: mqtt.MqttClient; let client: mqtt.MqttClient;

View File

@ -1,6 +1,6 @@
import { useCrud } from "@cool-vue/crud"; import { useCrud } from "@cool-vue/crud";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { defineComponent, nextTick, ref, watch } from "vue"; import { defineComponent, ref, watch } from "vue";
import { isBoolean, isFunction } from "lodash-es"; import { isBoolean, isFunction } from "lodash-es";
export default defineComponent({ export default defineComponent({
@ -10,7 +10,6 @@ export default defineComponent({
scope: null, scope: null,
column: null, column: null,
modelValue: [Number, String, Boolean], modelValue: [Number, String, Boolean],
api: Function,
activeValue: { activeValue: {
type: [Number, String, Boolean], type: [Number, String, Boolean],
default: 1 default: 1
@ -18,7 +17,8 @@ export default defineComponent({
inactiveValue: { inactiveValue: {
type: [Number, String, Boolean], type: [Number, String, Boolean],
default: 0 default: 0
} },
api: Function
}, },
emits: ["update:modelValue", "change"], emits: ["update:modelValue", "change"],
@ -30,15 +30,19 @@ export default defineComponent({
// 状态 // 状态
const status = ref<boolean | number | string>(); const status = ref<boolean | number | string>();
// 选中值类型
const activeValue = ref(); const activeValue = ref();
const inactiveValue = ref(); const inactiveValue = ref();
// 监听值
watch( watch(
() => props.modelValue, () => props.modelValue,
(val) => { (val) => {
// 首次获取类型 status.value = val;
if (activeValue.value === undefined) {
if (isBoolean(props.modelValue)) { if (val !== undefined) {
// 调整值类型
if (isBoolean(val)) {
activeValue.value = true; activeValue.value = true;
inactiveValue.value = false; inactiveValue.value = false;
} else { } else {
@ -46,8 +50,6 @@ export default defineComponent({
inactiveValue.value = props.inactiveValue; inactiveValue.value = props.inactiveValue;
} }
} }
status.value = val;
}, },
{ {
immediate: true immediate: true

View File

@ -13,8 +13,8 @@ export default (): Merge<ModuleConfig, CrudOptions> => {
label: "CRUD", label: "CRUD",
description: "快速增删改查及一系列辅助组件", description: "快速增删改查及一系列辅助组件",
author: "COOL", author: "COOL",
version: "1.0.4", version: "1.0.5",
updateTime: "2024-02-27", updateTime: "2024-02-28",
demo: "/demo/crud", demo: "/demo/crud",
// 组件全注册 // 组件全注册

1054
yarn.lock

File diff suppressed because it is too large Load Diff