2.2.0 • Published 4 years ago

rax-text v2.2.0

Weekly downloads
2,102
License
BSD-3-Clause
Repository
github
Last release
4 years ago

rax-text

npm

支持

Web / Weex / 阿里小程序 / 微信小程序 / 字节跳动小程序

描述

Text 用于显示文本,在 web 中实际上是一个 span 标签而非 p 标签。

安装

$ npm install rax-text --save

属性

属性类型默认值必填描述支持
numberOfLinesnumber1false行数
selectablebooleanfalsefalse是否可选
spacestringfalse以何种方式显示连续空格
decodebooleanfalse是否解码。为 true 时表示对文本内容进行解码,可解析的 HTML 实体字符有:  < > & '

示例

import {createElement, render, Component} from 'rax';
import DU from 'driver-universal';
import View from 'rax-view';
import Text from 'rax-text';

const styles = {
  root: {
    width: 750,
    paddingTop: 20,
  },
  container: {
    padding: 20,
    borderStyle: 'solid',
    borderColor: '#dddddd',
    borderWidth: 1,
    marginLeft: 20,
    marginRight: 20,
    marginBottom: 10,
  },
  textBlock: {
    fontWeight: '500',
    color: 'blue',
  },
  logBox: {
    padding: 20,
    margin: 10,
    borderWidth: 1,
    borderColor: '#f0f0f0',
    backgroundColor: '#f9f9f9',
  },
};

class App extends Component {
  render() {
    return (
      <View style={styles.root}>
        <View style={{
          ...styles.container, ...{
            flexDirection: 'row',
            justifyContent: 'flex-start',
          }
        }}>
          <Text>text</Text>
          <Text style={{
            color: '#ff4200'
          }}>Mixing</Text>
        </View>

        <View style={styles.container}>
          <Text numberOfLines={1} style={{
            width: 300,
            textOverflow: 'ellipsis',
          }}>Single line of text exceeds truncated text</Text>

          <Text numberOfLines={2} style={{
            width: 300,
            textOverflow: 'ellipsis',
          }}>
          Multi-line text exceeds truncated text, exceeds truncated text, exceeds truncated text, exceeds truncated text</Text>
        </View>

        <View style={styles.container}>
          <Text style={{textDecoration: 'underline'}}>
          Text underline
          </Text>
          <Text style={{textDecorationLine: 'none'}}>
           no Underlined
          </Text>
          <Text style={{textDecoration: 'line-through'}}>
          Text strikethrough
          </Text>
        </View>

        <View style={styles.container}>
          <Text style={{lineHeight: '120rpx'}}>
          Line height 120rpx, multi-line text text folding effect Multi-line text text folding effect
          </Text>
        </View>

      </View>
    );
  }
}

render(<App/>, document.body, {driver: DU});
felix-rax-inputtitle-component@vfa25/h5-watermarkdesign-test-a@everything-registry/sub-chunk-2533tboc-texttab-header-containerxl-rax-modaltemplate-buytemplate-chattemplate-taobaotemplate-zhihu@bondli/mini-biz-ui@bondli/mini-pos-sdk@bondli/mini-ui@rax-ui/list@rax-ui/loading@rax-ui/modal@rax-ui/pagination@rax-ui/picker@rax-ui/progress@rax-ui/radio@rax-ui/range@rax-ui/select@rax-ui/stepper@rax-ui/date-picker@rax-ui/dialog@rax-ui/field@rax-ui/filter@rax-ui/filter-combo-container@rax-ui/filter-helper@rax-ui/filter-list-select@rax-ui/filter-multi-select@rax-ui/form@rax-ui/grid@rax-ui/icon@rax-materials/success-block@rax-materials/user-detail-form@rax-materials/user-info-card@rax-ui/action-sheet@rax-ui/badge@rax-ui/button@rax-ui/calendar@rax-ui/carousel@rax-ui/checkbox@rax-materials/places@rax-materials/scaffolds-app-js@rax-materials/scaffolds-app-midway-faas@rax-materials/scaffolds-app-midway-miniapp@rax-materials/scaffolds-app-midway-ssr@rax-materials/scaffolds-app-shop@rax-materials/scaffolds-app-ts@rax-materials/scaffolds-basic-app@rax-materials/scaffolds-miniapp-ts@rax-materials/scaffolds-web-app-js@rax-materials/scaffolds-web-app-ts@rax-materials/blocks-text-card@rax-materials/confirm-modal@rax-materials/data-card@rax-materials/detail-edit@rax-materials/detail-form@rax-materials/exception-block@rax-materials/footer@rax-materials/goods@rax-materials/grid-list@rax-materials/header-searchjinboker-task-sdk@alizw/tesseract@aligov/tpl-h5-rax@aligov/tpl-h5-rax-sdk@aligov/use-pull-reload@aligov/progress@aligov/rax-page-module-blk@aligov/phone-verify@aligov/lisi-test-demo1@aligov/list-item@aligov/miniapp-city-list@aligov/miniapp-erro-modalbox@aligov/miniapp-portal-render@aligov/miniapp-search-page@aligov/render-engine-rax-page-blk@aligov/smart-banner@aligov/gov-h5-card-rax-sdk@aligov/gov-h5-guide-rax-sdk@aligov/gov-h5-rate-rax-sdk@aligov/gov-h5-spread-rax-sdk@aligov/miniapp-service@aligov/miniapp-user-box@aligov/miniapp-user-profile@aligov/miniapp-user-setting@aligov/mobile-app-search@aligov/mobile-c-button@aligov/mobile-c-checkbox@aligov/mobile-c-dialog@aligov/mobile-c-radio@aligov/mobile-c-select@aligov/mobile-c-step@aligov/mobile-c-toast@aligov/mobile-c-upload@aligov/mobile-component-dialog
2.2.0

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.1.0-0

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.5-0

4 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.1

5 years ago

2.0.0-0

5 years ago

2.0.0

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.7-0

5 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.3-0

6 years ago

1.1.2

6 years ago

1.1.2-1

6 years ago

1.1.2-0

6 years ago

1.1.1-beta.4

6 years ago

1.1.1

6 years ago

1.1.1-beta.3

6 years ago

1.1.1-beta.2

6 years ago

1.1.1-beta.1

6 years ago

1.1.0-2

6 years ago

1.1.0-1

6 years ago

1.1.0-0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.1-beta.1

6 years ago

1.0.1-beta.0

6 years ago

1.0.0-beta.5

6 years ago

1.0.0

6 years ago

1.0.0-beta.4

6 years ago

1.0.0-beta.3

6 years ago

1.0.0-beta.1

6 years ago

1.0.0-beta.0

6 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.4

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

8 years ago

0.4.20

8 years ago

0.4.19

8 years ago

0.4.18

8 years ago

0.4.17

8 years ago

0.4.16

8 years ago

0.4.15

8 years ago

0.5.0-beta

8 years ago

0.4.14

8 years ago

0.4.13

8 years ago

0.4.12

8 years ago

0.4.11

8 years ago

0.4.10

8 years ago

0.4.9

8 years ago

0.4.8

8 years ago

0.4.7

8 years ago

0.4.6

8 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.8

8 years ago

0.3.7

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.11

8 years ago

0.2.10

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago