message: chore(Skeleton): extract render fn
diff: @@ -40,12 +40,19 @@ export default createComponent({
  },
  setup(props, { slots }) {
  - return function () {
  - if (!props.loading) {
  - return slots.default && slots.default();
  + const renderAvatar = () => {
  + if (props.avatar) {
  + const size = addUnit(props.avatarSize);
  + return (
  + <div
  + class={bem('avatar', props.avatarShape)}
  + style={{ width: size, height: size }}
  + />
  + );
  }
  + };
  - function Title() {
  + const renderTitle = () => {
  if (props.title) {
  return (
  <h3
  @@ -54,13 +61,11 @@ export default createComponent({
  />
  );
  }
  - }
  + };
  - function Rows() {
  - const Rows = [];
  + const getRowWidth = (index) => {
  const { rowWidth } = props;
  - function getRowWidth(index) {
  if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
  return DEFAULT_LAST_ROW_WIDTH;
  }
  @@ -70,38 +75,31 @@ export default createComponent({
  }
  return rowWidth;
  - }
  + };
  +
  + const renderRows = () => {
  + const Rows = [];
  for (let i = 0; i < props.row; i++) {
  Rows.push(
  - <div
  - class={bem('row')}
  - style={{ width: addUnit(getRowWidth(i)) }}
  - />
  + <div class={bem('row')} style={{ width: addUnit(getRowWidth(i)) }} />
  );
  }
  return Rows;
  - }
  + };
  - function Avatar() {
  - if (props.avatar) {
  - const size = addUnit(props.avatarSize);
  - return (
  - <div
  - class={bem('avatar', props.avatarShape)}
  - style={{ width: size, height: size }}
  - />
  - );
  - }
  + return () => {
  + if (!props.loading) {
  + return slots.default?.();
  }
  return (
  <div class={bem({ animate: props.animate, round: props.round })}>
  - {Avatar()}
  + {renderAvatar()}
  <div class={bem('content')}>
  - {Title()}
  - {Rows()}
  + {renderTitle()}
  + {renderRows()}
  </div>
  </div>
  );
  