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

order-textarea

v1.1.0

Published

具有行号的有序文本域(适用于VUE3,风格基于ElementPlus)。

Downloads

8

Readme

具有行号的有序文本域(适用于VUE3,风格基于ElementPlus)。

示例图片

1. 安装

npm install order-textarea

2. 在组件中使用

<template>
    <order-textarea
      ref="orderTextareaRef"
      v-model="value"
      placeholder="请输入内容,每行一个"
      :row-height="32"
      :fixed-rows="undefined"
      :min-rows="2"
      :max-rows="10"
      :delete-blank-rows="false"
      :merge-repeat-rows="false"
      :limit-rows="0"
      :disabled="false"
      @focus="onFocus"
      @input="onInput"
      @blur="onBlur">
        <template #order="{number}">
            #{{ number }}
        </template>
        <template #placeholder>
            <div class="order-textarea__placeholder">
                自定义Placeholder
            </div>
            <div class="order-textarea__placeholder">
                <i>请输入内容,每行一个</i>
            </div>
        </template>
    </order-textarea>
    
    <div class="props">
        placeholder: 占位符,可使用slot自定义。默认为"请输入内容,每行一个"。
        rowHeight: 每行的高度。默认为32px。
        fixedRows: 固定行数,不设置此参数,行数会根据内容自适应。默认为undefined。
        minRows: 根据内容自适应行数的最小行数。如果设置了fixRows,minRows会被忽略。默认为2。
        maxRows: 根据内容自适应行数的最大行数,如果设置了fixRows,maxRows会被忽略。默认为10。
        trim: 是否去除每行的首尾空格。默认为false。
        deleteBlankRows: 是否删除空白行。默认为false。
        mergeRepeatRows: 是否合并重复行。默认为false。
        limitRows: 限制最大输入行数,超出的行数将被截断。默认为0,不限制。
        disabled: 是否禁用。默认为false。
        @focus: 当文本域获得焦点时触发。
        @input: 当文本域内容发生变化时触发。
        @blur: 当文本域失去焦点时触发。
    </div>
    <div class="exposes">
        scrollToRow(number, offset): 滚动到指定行。number: 行号; offset?: 滚动上下偏移量,默认为0。
    </div>
</template>

<script setup>
    import {ref} from "vue"
    import OrderTextarea from "order-textarea"

    const value = ref([])
    const orderTextareaRef = ref(null)
    
    function onFocus() {
        console.log("onFocus")
    }
    
    function onInput(val) {
        console.log("onInput", val)
    }

    function onBlur() {
        console.log("onBlur")
    }

    function scrollToRow() {
        orderTextareaRef.value.scrollToRow(50, 0)
    }
</script>

<style scoped>
    .order-textarea__placeholder{
        padding-left: 40px;
    }
</style>