修改传递显示

v1.0.0
于肖磊 2024-09-14 19:01:31 +08:00
parent f2433cc0ad
commit accc0f59d2
2 changed files with 28 additions and 26 deletions

View File

@ -8,6 +8,8 @@
</template>
<script setup lang="ts">
import { common_styles_computer } from '@/utils';
import { cloneDeep } from 'lodash';
const props = defineProps({
value: {
type: Object,
@ -15,27 +17,25 @@ const props = defineProps({
},
});
const style_container = ref('');
const article_tabs = ref(props.value);
watch(
article_tabs.value,
(newVal, oldValue) => {
const new_style = newVal?.style;
let new_data = newVal;
new_data.content.theme = new_data.content.article_theme;
new_data.content.data_type = new_data.content.tabs_list[0].data_type;
new_data.content.category_ids = new_data.content.tabs_list[0].category_ids;
new_data.content.carousel_col = new_data.content.article_carousel_col;
new_data.content.data_list = new_data.content.tabs_list[0].data_list;
new_data.content.data_ids = new_data.content.tabs_list[0].data_ids;
new_data.content.number = new_data.content.tabs_list[0].number;
new_data.content.order_by_type = new_data.content.tabs_list[0].order_by_type;
new_data.content.order_by_rule = new_data.content.tabs_list[0].order_by_rule;
new_data.content.field_show = new_data.content.field_show;
new_data.content.is_cover = new_data.content.tabs_list[0].is_cover;
article_tabs.value = new_data;
style_container.value += common_styles_computer(new_style.common_style);
},
{ immediate: true, deep: true }
);
const article_tabs = ref({});
watch(() => props.value, (val) => {
const newVal = cloneDeep(val);
const new_style = newVal?.style;
let new_data = newVal;
new_data.content.theme = new_data.content.article_theme;
new_data.content.data_type = new_data.content.tabs_list[0].data_type;
new_data.content.category_ids = new_data.content.tabs_list[0].category_ids;
new_data.content.carousel_col = new_data.content.article_carousel_col;
new_data.content.data_list = new_data.content.tabs_list[0].data_list;
new_data.content.data_ids = new_data.content.tabs_list[0].data_ids;
new_data.content.number = new_data.content.tabs_list[0].number;
new_data.content.order_by_type = new_data.content.tabs_list[0].order_by_type;
new_data.content.order_by_rule = new_data.content.tabs_list[0].order_by_rule;
new_data.content.field_show = new_data.content.field_show;
new_data.content.is_cover = new_data.content.tabs_list[0].is_cover;
article_tabs.value = new_data;
style_container.value += common_styles_computer(new_style.common_style);
}, { immediate: true, deep: true });
</script>
<style lang="scss" scoped></style>

View File

@ -8,6 +8,7 @@
</template>
<script setup lang="ts">
import { common_styles_computer } from '@/utils';
import { cloneDeep } from 'lodash';
const props = defineProps({
value: {
@ -19,11 +20,12 @@ const props = defineProps({
});
const style_container = ref('');
const tabs_list = ref(props.value);
const tabs_list = ref({});
watch(tabs_list.value, (val) => {
const new_style = val?.style;
let new_data = val;
watch(() => props.value, (val) => {
const new_val = cloneDeep(val);
const new_style = new_val?.style;
let new_data = new_val;
//
new_data.content.data_type = new_data.content.tabs_list[0].data_type;
new_data.content.category_ids = new_data.content.tabs_list[0].category_ids;