An open API service indexing awesome lists of open source software.

https://github.com/lkiarest/vue-ueditor

ueditor component for vue1.x
https://github.com/lkiarest/vue-ueditor

Last synced: 11 months ago
JSON representation

ueditor component for vue1.x

Awesome Lists containing this project

README

          

UEditor based Rich Text Editor component for vue 1.x

### install
`` shell
npm i vueueditor -S
``

### use

```html



import Ueditor from 'vueueditor'
export default {
data: () => ({
content: 'Hello World',
editorOpts: { // refer to 'http://fex.baidu.com/ueditor/#start-config'
maximumWords: 500
},
enabled: true
}),
components: {Ueditor}
}

```

### options
Refer to [UEditor Start Config](http://fex.baidu.com/ueditor/#start-config)

### methods

#### editor()
Get original UE instance, then you can do more things with the [UEditor Document](http://fex.baidu.com/ueditor/)
```javascript
var editor = this.$refs.ue.editor()
```

#### getContent()
Get html content from editor
```javascript
var content = this.$refs.ue.getContent()
```

#### setContent(val)
Set html content to editor
```javascript
var content = this.$refs.ue.setContent('Hello World')
// or change the bound data model
this.content = 'Hello World'
```

#### enable()
Enable to edit
```
this.$refs.ue.enable()
// or change the bound data model
this.enabled = true
```

#### disable()
Disable to edit
```
this.$refs.ue.disable()
// or change the bound data model
this.enabled = false
```

#### clear()
Clear all contents
```
this.$refs.ue.clear()
```

#### getContentLength(ignoreHtml)
Get length of content

**ignoreHtml** will ignore all html tags if set to true
```
this.$refs.ue.getContentLength()
```