npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@element-plus-ui/pro-text

v1.0.1

Published

🏆 Use Element Plus Text like a Pro!

Downloads

2

Readme

📦 安装

$ npm install @element-plus-ui/pro-text
$ yarn add @element-plus-ui/pro-text
$ pnpm add @element-plus-ui/pro-text

🔨 使用

<template>
  <pro-text class="mx-1">Default</pro-text>
  <pro-text class="mx-1" type="primary">Primary</pro-text>
  <pro-text class="mx-1" type="success">Success</pro-text>
  <pro-text class="mx-1" type="info">Info</pro-text>
  <pro-text class="mx-1" type="warning">Warning</pro-text>
  <pro-text class="mx-1" type="danger">Danger</pro-text>
</template>

<script setup lang="ts">
  import ProText from "@element-plus-ui/pro-text";
</script>

API

除了继承 ElText 的 API 以外还支持以下属性.

| 属性 | 描述 | 类型 | 默认值 | | -------- | --------- | ----------------------------------------------- | ------ | | content | 文本内容,优先级低于插槽. | string | - | | copyable | 文本复制. | boolean / CopyableConfig | false | | editable | 文本编辑. | boolean / EditableConfig | false |

CopyableConfig

| 属性 | 描述 | 类型 | 默认值 | | -------- | --------- | ----------------------------------------------- | ------ | | text | 复制的文本(未设置时,值为当前ProText文本内容). | string | - | | icon | 图标名称. | string / string[] | [DocumentCopy, Select, CloseBold] | | tooltip | 提示框文本. | string | - | | onCopy | 监听复制事件. |(isSuccess: boolean, text: string) => void` | - |

EditableConfig

| 属性 | 描述 | 类型 | 默认值 | | -------- | --------- | ----------------------------------------------- | ------ | | text | 编辑的文本(未设置时,值为当前ProText文本内容). | string | - | | icon | 图标名称. | string | EditPen | | tooltip | 提示框文本. | string | - | | editing | 是否编辑中. | boolean | false | | maxLength | 最大输入长度. | number | - | | autoSize | 自动resize文本域. | boolean / AutoSizeConfig | - | | onInput | 监听输入事件. | (text: string) => void | - | | onChange | 监听编辑状态变化. | (editing: boolean, text: string) => void | - |

AutoSizeConfig

| 属性 | 描述 | 类型 | 默认值 | | -------- | --------- | ----------------------------------------------- | ------ | | minRows | 最小行数. | number | - | | maxRows | 最大行数. | number | - |

🔨 案例

<template>
  <pro-text
    tag="i"
    :content="'通过content属性设置的文本,优先级低于默认插槽'"
    :truncated="true"
    :copyable="true"
    :editable="true"
  >
    通过插槽设置文本内容
  </pro-text>
</template>

<script setup lang="ts">
  import { ProText } from "@element-plus-ui/pro-text";
</script>
<template>
  <pro-text
    tag="i"
    :content="editValue"
    :truncated="true"
    :copyable="{
      text: '复制的文本',
      icon: ['CopyDocument', 'CircleCheck'],
      onCopy: (isSuccess: boolean, text: string) => {
        console.log(isSuccess, text);
      }
    }"
    :editable="{
      tooltip: '编辑文本',
      editing: isEditing,
      maxLength: 100,
      autoSize: { minRows: 3 },
      onInput: (text: string) => {
        editValue = text;
      },
      onChange: (editing: boolean, text: string) => {
        editValue = text;
        isEditing = editing;
      }
    }"
    style="font-size: 33px"
  />
</template>

<script setup lang="ts">
import { ProText } from "@element-plus-ui/pro-text";
import { ref } from "vue";

const editValue = ref("我是ProText组件");
const isEditing = ref(false);
</script>