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

diandi-ele-form-quill-editor

v0.0.3

Published

vue-ele-form 的富文本编辑器

Downloads

5

Readme

vue-ele-form-quill-editor | vue-ele-form 的一个富文本编辑器

MIT Licence npm download

介绍

vue-ele-form-quill-editor 做为 vue-ele-form 的第三方扩展, 用于富文本编辑

image

安装

npm install vue-ele-form-quill-editor --save

使用

import EleForm from 'vue-ele-form'
import EleFormQuillEditor from 'vue-ele-form-quill-editor'
// 注册 vue-ele-form
Vue.use(EleForm, {
  // 全局设置
  // 可以为编辑器配置全局属性, 每个实例都共享这个属性
  'quill-editor': {
    // 比如设置上传 action 后, 所有的 quill-editor 编辑器上传图片都会采用这个属性
    action: 'https://xxx.com/upload/images'
  }
})

// 注册 quill-editor 组件
Vue.component('quill-editor', EleFormQuillEditor)
// 局部设置
formDesc: {
  xxx: {
    label: 'xxx',
    type: 'quill-editor', // 只需要在这里指定为 quill-editor 即可
    // 属性由两部分组成
    // 1.上传图片相关属性
    // 2.编辑器相关属性, 参考: https://github.com/davidroyer/vue2-editor 和 https://quilljs.com/
    attrs: {
      // 上传相关
      action: 'https://xxx.com/upload/images', // 上传地址
      data: {token: 'xxx'},
      // 对响应结果进一步处理
      responseFn (response, file) {
        return 'https://xxx.com/upload/images' + response.url // 这里返回上传后的url即可
      },
      // 编辑器相关属性
      placeholder: '请输入...'
    }
  }
}

示例

<template>
  <ele-form
    v-model="formData"
    :form-desc="formDesc"
    :request-fn="handleRequest"
    :span="22"
    @request-success="handleSuccess"
  />
</template>

<script>
export default {
  data () {
    return {
      formData: {},
      formDesc: {
        content: {
          label: '文章内容',
          type: 'quill-editor',
          attrs: {
            action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
            responseFn (response, file) {
              // 因为是 mock 地址, 所以, 总是返回同一张图片的URL, 正常使用的时候不会
              return response.url
            }
          }
        }
      }
    }
  },
  methods: {
    handleRequest (data) {
      console.log(data)
      return Promise.resolve()
    },
    handleSuccess () {
      this.$message.success('提交成功')
    }
  }
}
</script>

上传图片说明

props: {
  // 上传地址
  action: String,
  // 图片大小限制
  fileSize: {
    type: Number
  },
  // 文件名
  name: {
    type: String,
    default: 'file'
  },
  // 上传图片的头部
  headers: Object,
  // 是否需要带cookie
  withCredentials: Boolean,
  // 自定义上传数据, 例如 {token: xxx}
  data: Object,
  // 上传成功的进一步处理
  responseFn: Function
}

相关链接