From 8e815c9c50e5f56810ea13b9f5b28c6455aa3d84 Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 22 Dec 2020 20:26:04 +0800 Subject: [PATCH] perf(divider): use wxs (#3887) --- packages/divider/index.ts | 35 +++++++---------------------------- packages/divider/index.wxml | 5 +++-- packages/divider/index.wxs | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 30 deletions(-) create mode 100644 packages/divider/index.wxs diff --git a/packages/divider/index.ts b/packages/divider/index.ts index df1e2d65..7055aa5d 100644 --- a/packages/divider/index.ts +++ b/packages/divider/index.ts @@ -2,33 +2,12 @@ import { VantComponent } from '../common/component'; VantComponent({ props: { - dashed: { - type: Boolean, - value: false, - }, - hairline: { - type: Boolean, - value: false, - }, - contentPosition: { - type: String, - value: '', - }, - fontSize: { - type: Number, - value: '', - }, - borderColor: { - type: String, - value: '', - }, - textColor: { - type: String, - value: '', - }, - customStyle: { - type: String, - value: '', - }, + dashed: Boolean, + hairline: Boolean, + contentPosition: String, + fontSize: String, + borderColor: String, + textColor: String, + customStyle: String, }, }); diff --git a/packages/divider/index.wxml b/packages/divider/index.wxml index 412e73f2..f6a5a457 100644 --- a/packages/divider/index.wxml +++ b/packages/divider/index.wxml @@ -1,8 +1,9 @@ + diff --git a/packages/divider/index.wxs b/packages/divider/index.wxs new file mode 100644 index 00000000..215b14f4 --- /dev/null +++ b/packages/divider/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style([ + { + 'border-color': data.borderColor, + color: data.textColor, + 'font-size': addUnit(data.fontSize), + }, + data.customStyle, + ]); +} + +module.exports = { + rootStyle: rootStyle, +};