Socket
Book a DemoInstallSign in
Socket

lcap-wang-editor

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lcap-wang-editor

<!-- 该 README.md 根据 api.yaml 和 docs/*.md 自动生成,为了方便在 GitHub 和 NPM 上查阅。如需修改,请查看源文件 -->

latest
npmnpm
Version
0.1.6
Version published
Weekly downloads
5
150%
Maintainers
3
Weekly downloads
 
Created
Source

LcapWangEditor 富文本

  • 示例
  • API

Form

请在这里添加描述

示例

基本用法

<lcap-wang-editor value="<p>hello</p><img src='https://p3-passport.byteimg.com/img/user-avatar/834687b5e4137f4d998a95be7330f543~180x180.awebp'>"></lcap-wang-editor>

自定义上传地址

<lcap-wang-editor value="<p>hello</p><img src='https://p3-passport.byteimg.com/img/user-avatar/834687b5e4137f4d998a95be7330f543~180x180.awebp'" uploadImgServer="/upload/test"></lcap-wang-editor>

只读模式

只读模式可以作为富文本编辑器的内容展示区,默认隐藏工具栏,通过readOnly设置

<template>
    <div>
        <lcap-wang-editor :readOnly="readOnly" value="<p>hello</p><img src='https://p3-passport.byteimg.com/img/user-avatar/834687b5e4137f4d998a95be7330f543~180x180.awebp'>"></lcap-wang-editor>
        <u-button @click="handleReadOnly">切换</u-button>
    </div>
</template>

<script>
export default {
    data() {
        return {
            readOnly: true
        }
    },
    methods:{
        handleReadOnly() {
            this.readOnly = !this.readOnly;
        },
    }
}
</script>

表单验证

<template>
<u-form ref="form" gap="large">
    <u-form-item :required="true" layout="block" rules="required" label="业务口径">
        <lcap-wang-editor :value.sync="value" :editorStyle="editorStyle"></lcap-wang-editor>
    </u-form-item>
    <u-form-item layout="block">
        <u-button @click="onClick">验证</u-button>
    </u-form-item>
</u-form>
</template>

<script>
export default {
    data() {
        return {
            value: '',
            editorStyle: 'height: 300px',
        }
    },
    mounted() {
        setTimeout(() => {
            this.value = '我有内容了';
        }, 1000);
    },
    methods: {
        async onClick() {
            const valid = await this.$refs.form.validate();
        },
    },
}
</script>

API

Props/Attrs

Prop/AttrTypeOptionsDefaultDescription
value.syncstring''需要传入的文本内容
readOnlybooleanfalse启用只读模式
scrollbooleantrue启用滚动
placeholderstring''输入提示
editorStylestring''编辑器样式CSS
uploadImgServerstring''上传图片地址

Events

@change

内容修改时触发

ParamTypeDescription
$event.valuestring当前输入区域的内容
$event.editorstringwangeditor 实例

@input

输入时触发

ParamTypeDescription
valuestring当前输入区域的内容

Keywords

lcap

FAQs

Package last updated on 13 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts