0.1.51 • Published 4 years ago

xi-editor v0.1.51

Weekly downloads
28
License
-
Repository
-
Last release
4 years ago

xi-editor

安装

npm install xi-editor --save

使用示例

<template>
  <div id="app">
    <xiEditor v-model="richText" menubar @imagesUpload="handleImgUpload"></xiEditor>
    {{ richText }}
  </div>
</template>

<script>
import axios from "axios";
import {xiEditor} from "xi-editor";
import 'xi-editor/dist/main.css'
export default {
  name: "App",
  data() {
    return {
      richText: "abc",
    };
  },
  components: {
    xiEditor
  },
  methods: {
    handleImgUpload({ blobInfo, success }) {
      const data = new FormData();
      data.append("file", blobInfo.blob(), blobInfo.filename());
      const config = {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      };
      /* axios.post("http://xxx/uploadFile", data, config).then((resp) => {
          success(resp.data.data);
        }); */
    },
  },
};
</script>

API

属性类型说明默认值
value(v-model)string富文本值""
menubarboolean是否显示菜单栏false
widthstring/number宽度'100%'
heightstring/number高度'200px'
max_widthstring/number最大宽度
max_heightstring/number最大高度
min_widthstring/number最小宽度
min_heightstring/number最小高度
languagestring语言(可选zh_CN,en_us)'zh_CN'
disabledboolean是否禁用false
事件名称说明回调参数
imagesUpload自定义图片上传函数function(blobInfo, success, failure)

blobInfo 图片二进制数据

success 图片上传成功后需要调用success(url)把地址返回编辑器

0.1.51

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago