ace-editor-vue3

Like vue2-ace-editor but more functional and supports Vue 3
19,103 2
Install
npm install ace-editor-vue3
Latest Version:1.1.2
License:ISC
Last Updated:Mar 19, 2022
Links: GitHub  ·  npm
Maintainer: drdung19999

ace-editor-vue3

A package of ace support for vue3.

Installation

Installation is done using the npm install command:

npm i ace-editor-vue3

Example

<template>
  <AceEditor
    v-model:codeContent="value" 
    v-model:editor="editor"
    :options="options"
    :theme="theme"
    :lang="lang"
    width="100%" 
    height="300px" 
  />
  <button @click="setValue">set value</button>
  <button @click="getValue">get value</button>
  <button @click="setSize">set size</button>
</template>

<script>
import AceEditor from "ace-editor-vue3";
import "brace/mode/javascript";
import "brace/theme/monokai";

export default {
  components: {
    AceEditor
  },

  data() {
    return {
      editor: null,
      value: `console.log("hello ok.")`,
      options: {"showPrintMargin": false},
      lang: "javascript",
      theme: "monokai", 
    }
  },

  methods: {
    setValue() {
      this.value = `const a = 100;`;
    },

    getValue() {
      console.log(this.value);
    },

    setSize() {
      this.editor.setFontSize(32);
    }
  },

  watch: {
    value() {
      console.log("use typing code:");
      console.log(this.value);
    }
  },
}
</script>

<style>

</style>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Related Packages

v-ace-editor

一个包装 ace 灵感来自vue3-ace-editor, javascript版本

1,707 3
bd-editor

ace编辑器

513
vue-prism-editor

A dead simple code editor with syntax highlighting and line numbers.

3,560,154 755
vue-use-gesture

Vue hook for receiving gestures https://vue-use-gesture.netlify.app

36,138 150
@highlighted/vue-js-editor

Simple code editor with syntax highlighting and line numbers.

1,932

Version History

Version Released License
1.1.2 ISC
1.1.1 ISC
1.1.0 ISC
1.0.1 ISC
1.0.0 ISC