0.0.7 • Published 2 years ago

@thtf/vue-textarea-autocomplete v0.0.7

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

自动提示文本组件

依赖

Vue 2.6.10+

安装

npm install @thtf/vue-textarea-autocomplete

发布

main 分支提交即可。

快速上手

// 使用组件
<template>
  <div id="app">
    <p>本地测试</p>
    <div style="height: 300px; width: 500px">
      <autocomplete :rules="rules" @matched="matched"/>
    </div>
  </div>
</template>
<script>
  // 安装组件
  import Autocomplete from '@thtf/vue-textarea-autocomplete'

  // 引用组件
  export default {
    components: {
      Autocomplete
    },
    data() {
      return {
        extracts: [],
        rules: [
          {
            rule: /[A-Za-z0-9]+/,
            data: [{ label: '指标', value: '001' }, { label: '时点', value: '002' }],
          },
        ],
      };
    },
    methods: {
      matched(rule, query, row) {
        console.log(`rule ${JSON.stringify(rule)}`);
        console.log(`query ${JSON.stringify(query)}`);
        console.log(`row ${JSON.stringify(row)}`);
      },
    },
  }
</script>

@thtf/vue-textarea-autocomplete Attributes

参数说明类型可选值默认值
rules匹配规则array--
debounce输入时防抖等待时间Number-300
minWidthsuggester 最小宽度string-180px
remote是否为远程远程匹配Boolean-false
loadingremote 为 true 时,是否正在从远程获取数据Boolean-false
optionsremote 为 true 时,远程获取数据列表Array-[]

rules Attributes

参数说明类型可选值默认值
rule匹配规则正则--
enterAdd选中 item 时 向末尾添加的字符string-空格
data匹配规则成功时,suggester 显示列表,remote 为 true 时无效array-[]

@thtf/vue-textarea-autocomplete Methods

方法名说明参数
change触发匹配的方法-

@thtf/vue-textarea-autocomplete Events

方法名说明回调参数
matched匹配成功时触发匹配规则对应的字符串,匹配内容,规则对象
change获取内容文本内容
0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago