ホームページ  >  記事  >  ウェブフロントエンド  >  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 add

<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 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。