From 68c033b4fb4e69cfca41719291529b8b7747ce6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Sat, 19 Oct 2024 16:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E9=A2=98=E9=80=BB=E8=BE=91=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/diy/title.vue | 48 ++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/components/diy/title.vue b/components/diy/title.vue index 9c77d11d..97f95f48 100644 --- a/components/diy/title.vue +++ b/components/diy/title.vue @@ -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);