标题逻辑处理

master
于肖磊 2024-10-19 16:31:32 +08:00
parent ce503dda5b
commit 68c033b4fb
1 changed files with 17 additions and 31 deletions

View File

@ -81,28 +81,10 @@
isEmpty,
//
init() {
this.setData({
form: this.propValue.content,
new_style: this.propValue.style,
});
//
this.setData({
title_center: this.form.is_title_center == '1' ? 'jc-c' : '',
});
//
this.set_keyword_list();
//
this.set_common_styles();
},
//
set_keyword_list() {
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;
const new_form = this.propValue.content;
const new_style = this.propValue.style;
const { keyword_color, keyword_size, right_color, right_size, common_style, title_weight, title_color, title_size } = new_style;
//
let common_styles = '';
if (title_weight == 'italic') {
@ -110,26 +92,30 @@
} else if (title_weight == '500') {
common_styles += `font-weight: 500`;
}
//
this.setData({
form: new_form,
new_style: new_style,
title_center: new_form.is_title_center == '1' ? 'jc-c' : '',
keyword_list: new_form.keyword_list.filter((item) => item.is_show == '1'), //
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}`,
subtitle_style: this.get_subtitle_style(), //
right_style: `color:${right_color}; font-size: ${right_size * 2}rpx;`, //
title_style: `color:${title_color}; font-size: ${title_size * 2}rpx; ${common_styles}`, //
subtitle_style: this.get_subtitle_style(new_style), //
style_container: common_styles_computer(common_style), //
style_img_container: common_img_computer(common_style, this.propIndex),
style_img_container: common_img_computer(common_style, this.propIndex), //
});
},
//
get_subtitle_style() {
get_subtitle_style(new_style) {
let common_styles = '';
if (this.new_style.subtitle_weight == 'italic') {
if (new_style.subtitle_weight == 'italic') {
common_styles += `font-style: italic`;
} else if (this.new_style.subtitle_weight == '500') {
} else if (new_style.subtitle_weight == '500') {
common_styles += `font-weight: 500`;
}
return `color:${this.new_style.subtitle_color}; font-size: ${this.new_style.subtitle_size * 2}rpx; ${common_styles}`;
return `color:${new_style.subtitle_color}; font-size: ${new_style.subtitle_size * 2}rpx; ${common_styles}`;
},
url_event(e) {
app.globalData.url_event(e);