fix(form-design): CollapseItem组件页面css添加prefixCls前缀, 防止打包后污染全局样式 (#2654)

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
This commit is contained in:
Wit〆苗大 2023-03-30 09:53:03 +08:00 committed by GitHub
parent 1b30834eb3
commit f05b90f86b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 28 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div> <div :class="prefixCls">
<draggable <draggable
tag="ul" tag="ul"
:model-value="list" :model-value="list"
@ -36,6 +36,7 @@
import draggable from 'vuedraggable'; import draggable from 'vuedraggable';
// import { toRefs } from '@vueuse/core'; // import { toRefs } from '@vueuse/core';
import { Icon } from '/@/components/Icon'; import { Icon } from '/@/components/Icon';
import { useDesign } from '/@/hooks/web/useDesign';
export default defineComponent({ export default defineComponent({
name: 'CollapseItem', name: 'CollapseItem',
@ -51,6 +52,8 @@
}, },
}, },
setup(props, { emit }) { setup(props, { emit }) {
const { prefixCls } = useDesign('form-design-collapse-item');
const state = reactive({}); const state = reactive({});
const handleStart = (e: any, list1: IVFormComponent[]) => { const handleStart = (e: any, list1: IVFormComponent[]) => {
emit('start', list1[e.oldIndex].component); emit('start', list1[e.oldIndex].component);
@ -63,14 +66,16 @@
const cloneItem = (one) => { const cloneItem = (one) => {
return props.handleListPush(one); return props.handleListPush(one);
}; };
return { state, handleStart, handleAdd, cloneItem }; return { prefixCls, state, handleStart, handleAdd, cloneItem };
}, },
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@prefix-cls: ~'@{namespace}-form-design-collapse-item';
@import url(../styles/variable.less); @import url(../styles/variable.less);
.@{prefix-cls} {
ul { ul {
padding: 5px; padding: 5px;
list-style: none; list-style: none;
@ -103,4 +108,5 @@
svg { svg {
display: inline !important; display: inline !important;
} }
}
</style> </style>