0.0.9 • Published 2 years ago

wang-message-editor v0.0.9

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

install

wang-message-editor

use

main.js

import Vue from 'vue'
import wangMessageEditor from "wang-message-editor";
Vue.use(wangMessageEditor)
<template>
  <div id="app">
    <wangMessageEditor @input="input" :limitInputLength="0" 
      ref="editRef"
	/>
  </div>
</template>

<script>
import wangMessageEditor from "./components/index";
export default {
  name: "App",
  data() {
    return {};
  },
  components: {
    wangMessageEditor,
  },
  methods: {
    input(e) {
      console.log(e);
    },
      清空输入框内容fn
    clear(){
        this.$refs.editRef.clear()
    }
  },
};
</script>

methods

参数说明参数备注
input输入框改变事件当设置 limitInputLength 大于0时,输出参数为{content: 'we', isOverflow: false};当设置 limitInputLength 为0时,输出参数为 当前输入的内容字符串,而非对象
clear清空editor
focuseditor获取焦点
setContent设置输入框内容参数为字符串多次调用,会覆盖上次的内容
setTextContentAdd追加内容(文本)string
setHyperTextContentAdd追加内容(超文本)html 字符串格式的 html,例如 <a href="www.xx.com"> a</a>

props

limitInputLength 输入框字数限制,

参数参数类型功能
limitInputLengthNumber输入框字数限制

效果展示

image-20220517170110107

0.0.3

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago