修改传递参数为setData

master
于肖磊 2024-09-12 14:27:14 +08:00
parent 297ab5dd32
commit 50e82a7d33
5 changed files with 83 additions and 58 deletions

View File

@ -25,17 +25,23 @@
};
},
created() {
const {
height
} = this.value.content;
const {
line_color,
common_style
} = this.value.style;
this.style = `height: ${height * 2 }rpx;background: ${line_color || 'transparent'};`;
this.style_container = common_styles_computer(common_style);
this.init();
},
methods: {
init() {
const {
height
} = this.value.content;
const {
line_color,
common_style
} = this.value.style;
this.setData({
style: `height: ${height * 2 }rpx;background: ${line_color || 'transparent'};`,
style_container: common_styles_computer(common_style)
});
}
},
methods: {},
};
</script>

View File

@ -184,19 +184,21 @@
}
},
slideChange(e) {
this.animationData = e.target.current;
let actived_index = e.target.current;
if (e.target.current > this.form.carousel_list.length - 1) {
const seat_length = this.seat_list.length;
if (seat_length == 2 && e.target.current == 3) {
this.actived_index = 1;
actived_index = 1;
} else if (seat_length == 3) {
this.actived_index = 0;
actived_index = 0;
} else {
this.actived_index = e.target.current - this.seat_list.length;
actived_index = e.target.current - this.seat_list.length;
}
} else {
this.actived_index = e.target.current;
}
this.setData({
animationData: e.target.current,
actived_index: actived_index
})
},
get_video_style() {
const { video_bottom, video_radius, video_color_list, video_direction, video_title_color, video_padding} = this.new_style;
@ -217,11 +219,15 @@
})
this.$refs.popup.open();
const videoContext = uni.createVideoContext('carousel_video');
videoContext.play();
if (!is_obj_empty(videoContext)) {
videoContext.play();
}
},
video_close() {
const videoContext = uni.createVideoContext('carousel_video');
videoContext.pause();
if (!is_obj_empty(videoContext)) {
videoContext.pause();
}
this.$refs.popup.close();
}
},

View File

@ -33,18 +33,25 @@ export default {
};
},
created() {
this.form = this.value.content;
this.new_style = this.value.style;
const { float_style, float_style_color, display_location, offset_number } = this.value.style;
this.color = float_style == 'shadow' ? `box-shadow: 0 10rpx 40rpx ${ float_style_color }` : `background-color: ${ float_style_color }`;
let location = `right: 20rpx;`;
if (display_location == 'left') {
location = `left: 20rpx;`;
}
const { windowHeight } = uni.getSystemInfoSync();
this.style = `bottom: ${((offset_number / windowHeight) * 100).toFixed(4) + '%'};` + location;
this.setData({
form: this.value.content,
new_style: this.value.style
});
this.init();
},
methods: {
init() {
const { float_style, float_style_color, display_location, offset_number } = this.value.style;
let location = `right: 20rpx;`;
if (display_location == 'left') {
location = `left: 20rpx;`;
}
const { windowHeight } = uni.getSystemInfoSync();
this.setData({
color: float_style == 'shadow' ? `box-shadow: 0 10rpx 40rpx ${ float_style_color }` : `background-color: ${ float_style_color }`,
style: `bottom: ${((offset_number / windowHeight) * 100).toFixed(4) + '%'};` + location
});
},
url_open() {
const { button_jump, button_link} = this.form;
if (button_jump == 'link' && !is_obj_empty(button_link)) {

View File

@ -60,24 +60,23 @@
};
},
created() {
this.form = this.value.content;
this.new_style = this.value.style;
this.setData({
form: this.value.content,
new_style: this.value.style
});
this.init();
},
methods: {
is_obj_empty,
init() {
const { search_button_radius, common_style } = this.new_style;
//
this.style = this.get_style();
//
this.style_container = this.isPageSettings ? '' : common_styles_computer(common_style);
//
this.search_button_radius = radius_computer(search_button_radius);
//
this.box_style = this.get_box_style();
//
this.search_button = this.get_search_button();
this.setData({
style: this.get_style(), //
style_container: this.isPageSettings ? '' : common_styles_computer(common_style), //
search_button_radius: radius_computer(search_button_radius), //
box_style: this.get_box_style(), //
search_button: this.get_search_button(), //
});
},
get_style() {
let common_styles = '';
@ -107,7 +106,6 @@
}
style += gradient_computer(data) + background_computer(data) + `color: ${ this.new_style.button_inner_color };`;
}
console.log(style);
return style;
}
},

View File

@ -41,26 +41,30 @@ export default {
};
},
created() {
this.form = this.value.content;
this.new_style = this.value.style;
//
this.title_center = this.form.is_title_center == '1' ? 'jc-c' : '';
//
this.set_keyword_list();
//
this.set_common_styles();
this.setData({
form: this.value.content,
new_style: this.value.style
});
this.init();
},
methods: {
init() {
//
this.setData({
title_center: this.form.is_title_center == '1' ? 'jc-c' : ''
});
//
this.set_keyword_list();
//
this.set_common_styles();
},
set_keyword_list() {
this.keyword_list = this.form.keyword_list.filter(item => item.is_show == '1');
this.setData({
keyword_list: this.form.keyword_list.filter(item => item.is_show == '1')
});
},
set_common_styles() {
const { keyword_color, keyword_size, right_color, right_size, common_style, title_weight, title_color, title_size } = this.new_style;
//
this.keyword_style = `color:${ keyword_color }; font-size: ${ keyword_size * 2 }rpx;`;
//
this.right_size = right_size * 2 + 'rpx';
this.right_style = `color:${ right_color }; font-size: ${ right_size * 2 }rpx;`;
//
let common_styles = '';
if (title_weight == 'italic') {
@ -68,9 +72,13 @@ export default {
} else if (title_weight == '500') {
common_styles += `font-weight: 500`;
}
this.title_style = `color:${ title_color }; font-size: ${ title_size * 2 }rpx; ${ common_styles }`;
//
this.style_container = common_styles_computer(common_style);
this.setData({
keyword_style: `color:${ keyword_color }; font-size: ${ keyword_size * 2 }rpx;`, //
right_size: right_size * 2 + 'rpx' ,//
right_style: `color:${ right_color }; font-size: ${ right_size * 2 }rpx;`,
title_style: `color:${ title_color }; font-size: ${ title_size * 2 }rpx; ${ common_styles }`,
style_container: common_styles_computer(common_style) //
})
},
url_open_event(link) {
if (!is_obj_empty(link)) {