mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
perf(cell): use wxs (#3888)
This commit is contained in:
parent
8e815c9c50
commit
0c3383a6c5
@ -1,4 +1,5 @@
|
|||||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
|
<wxs src="./index.wxs" module="computed" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}"
|
class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}"
|
||||||
@ -16,7 +17,7 @@
|
|||||||
<slot wx:else name="icon" />
|
<slot wx:else name="icon" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
style="{{ (titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth + ';' : '') + titleStyle }}"
|
style="{{ computed.titleStyle({ titleWidth, titleStyle }) }}"
|
||||||
class="van-cell__title title-class"
|
class="van-cell__title title-class"
|
||||||
>
|
>
|
||||||
<block wx:if="{{ title }}">{{ title }}</block>
|
<block wx:if="{{ title }}">{{ title }}</block>
|
||||||
|
17
packages/cell/index.wxs
Normal file
17
packages/cell/index.wxs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
var style = require('../wxs/style.wxs');
|
||||||
|
var addUnit = require('../wxs/add-unit.wxs');
|
||||||
|
|
||||||
|
function titleStyle(data) {
|
||||||
|
return style([
|
||||||
|
{
|
||||||
|
'max-width': addUnit(data.titleWidth),
|
||||||
|
'min-width': addUnit(data.titleWidth),
|
||||||
|
},
|
||||||
|
data.titleStyle,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
titleStyle: titleStyle,
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user