>  기사  >  웹 프론트엔드  >  vue 프로젝트에서 ueditor를 사용하여(자세한 튜토리얼)

vue 프로젝트에서 ueditor를 사용하여(자세한 튜토리얼)

亚连
亚连원래의
2018-06-01 14:43:153304검색

아래에서는 Vue 프로젝트에서 ueditor를 사용하는 예를 공유하겠습니다. 이는 좋은 참고 가치가 있으며 모든 사람에게 도움이 되기를 바랍니다.

vue-cli로 생성된 프로젝트를 예로 들어보겠습니다

1. 먼저 ueditor 파일을 1.static 폴더에 넣습니다

2.index.html 다음 코드를 추가합니다

<script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.all.min.js"></script>

3.webpack.base.conf.js

externals: {
  &#39;UE&#39;: &#39;UE&#39;,
 },

4.index.html에 다음 구성을 추가합니다.

<script type="text/javascript">
 window.UEDITOR_HOME_URL = "/static/ueditor/";//配置路径设定为UEditor所放的位置
</script>

5. 에디터 컴포넌트

<template>
 <p>
  <mt-button @click="geteditor()" type="danger">获取</mt-button>
  <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
 </p>
</template>
<script>
const UE = require(&#39;UE&#39;);// eslint-disable-line
export default {
 name: &#39;editorView&#39;,
 data: () => (
  {
   editor: null,
  }
 ),
 methods: {
  geteditor() {
   console.log(this.editor.getContent());
  },
 },
 mounted() {
  this.editor = UE.getEditor(&#39;editor&#39;);
 },
 destroyed() {
  this.editor.destroy();
 },
};
</script>
<style>
</style>

위 내용은 제가 모두를 위해 정리한 내용입니다. 앞으로 모든 분들께 도움이 되길 바랍니다.

관련 기사:

vue는 트리 메뉴 효과를 구현합니다

VUE 주요 문제 요약

p5.js 입문 튜토리얼 키보드 상호 작용

위 내용은 vue 프로젝트에서 ueditor를 사용하여(자세한 튜토리얼)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.