最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue3中ace-editor的簡(jiǎn)單使用方法實(shí)例

 更新時(shí)間:2023年10月23日 11:10:27   作者:youhebuke225  
這篇文章主要給大家介紹了關(guān)于vue3中ace-editor簡(jiǎn)單使用的相關(guān)資料,ace-editor是一種代碼編輯器,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下

簡(jiǎn)介

安裝

首先我們下載編輯器,當(dāng)然我們也可以使用npm進(jìn)行下載

yarn add vue3-ace-editor

我們?cè)趘ue3中寫上如下代碼

<script setup lang="ts">
import { ref } from "vue";
import { VAceEditor } from "vue3-ace-editor"

const content = ref("<div>Hello World</div>")
</script>

<template>
    <v-ace-editor v-model:value="content" lang="html" theme="github" style="height: 300px" />
</template>

這個(gè)時(shí)候代碼編輯器就顯示出來了

深入

但是我們會(huì)發(fā)現(xiàn)這時(shí)候主題和高亮似乎沒有生效,編輯器的主題也沒有生效

這個(gè)時(shí)候我們新建一個(gè)文件ace.config.ts,寫上如下代碼

import ace from 'ace-builds';

import modeJsonUrl from 'ace-builds/src-noconflict/mode-json?url';
ace.config.setModuleUrl('ace/mode/json', modeJsonUrl);

import modeJavascriptUrl from 'ace-builds/src-noconflict/mode-javascript?url';
ace.config.setModuleUrl('ace/mode/javascript', modeJavascriptUrl);

import modeHtmlUrl from 'ace-builds/src-noconflict/mode-html?url';
ace.config.setModuleUrl('ace/mode/html', modeHtmlUrl);

import modeYamlUrl from 'ace-builds/src-noconflict/mode-yaml?url';
ace.config.setModuleUrl('ace/mode/yaml', modeYamlUrl);

import themeGithubUrl from 'ace-builds/src-noconflict/theme-github?url';
ace.config.setModuleUrl('ace/theme/github', themeGithubUrl);

import themeChromeUrl from 'ace-builds/src-noconflict/theme-chrome?url';
ace.config.setModuleUrl('ace/theme/chrome', themeChromeUrl);

import themeMonokaiUrl from 'ace-builds/src-noconflict/theme-monokai?url';
ace.config.setModuleUrl('ace/theme/monokai', themeMonokaiUrl);

import workerBaseUrl from 'ace-builds/src-noconflict/worker-base?url';
ace.config.setModuleUrl('ace/mode/base', workerBaseUrl);

import workerJsonUrl from 'ace-builds/src-noconflict/worker-json?url';
ace.config.setModuleUrl('ace/mode/json_worker', workerJsonUrl);

import workerJavascriptUrl from 'ace-builds/src-noconflict/worker-javascript?url';
ace.config.setModuleUrl('ace/mode/javascript_worker', workerJavascriptUrl);

import workerHtmlUrl from 'ace-builds/src-noconflict/worker-html?url';
ace.config.setModuleUrl('ace/mode/html_worker', workerHtmlUrl);

import workerYamlUrl from 'ace-builds/src-noconflict/worker-yaml?url';
ace.config.setModuleUrl('ace/mode/yaml_worker', workerYamlUrl);

import snippetsHtmlUrl from 'ace-builds/src-noconflict/snippets/html?url';
ace.config.setModuleUrl('ace/snippets/html', snippetsHtmlUrl);

import snippetsJsUrl from 'ace-builds/src-noconflict/snippets/javascript?url';
ace.config.setModuleUrl('ace/snippets/javascript', snippetsJsUrl);

import snippetsYamlUrl from 'ace-builds/src-noconflict/snippets/yaml?url';
ace.config.setModuleUrl('ace/snippets/javascript', snippetsYamlUrl);

import snippetsJsonUrl from 'ace-builds/src-noconflict/snippets/json?url';
ace.config.setModuleUrl('ace/snippets/json', snippetsJsonUrl);

import 'ace-builds/src-noconflict/ext-language_tools';
ace.require("ace/ext/language_tools");

寫完之后,我們?cè)谑褂玫牡胤揭胍幌庐?dāng)前的配置文件便可

import '../../ace.config';

總結(jié)

到此這篇關(guān)于vue3中ace-editor的簡(jiǎn)單使用的文章就介紹到這了,更多相關(guān)vue3中ace-editor使用內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:

相關(guān)文章

  • Vue中使用正則表達(dá)式進(jìn)行文本匹配和處理的方法小結(jié)

    Vue中使用正則表達(dá)式進(jìn)行文本匹配和處理的方法小結(jié)

    正則表達(dá)式在Vue中具有廣泛的應(yīng)用場(chǎng)景,包括文本匹配和處理、表單驗(yàn)證等,通過本文的介紹和示例,希望讀者能更好地理解和應(yīng)用正則表達(dá)式在Vue中的使用方法,感興趣的朋友一起看看吧
    2023-11-11
  • 2分鐘實(shí)現(xiàn)一個(gè)Vue實(shí)時(shí)直播系統(tǒng)的示例代碼

    2分鐘實(shí)現(xiàn)一個(gè)Vue實(shí)時(shí)直播系統(tǒng)的示例代碼

    這篇文章主要介紹了2分鐘實(shí)現(xiàn)一個(gè)Vue實(shí)時(shí)直播系統(tǒng)的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • vue 怎么創(chuàng)建組件及組件使用方法

    vue 怎么創(chuàng)建組件及組件使用方法

    vue中的核心就是組件,組件 (Component) 是 Vue.js 最強(qiáng)大的功能之一。組件可以擴(kuò)展 HTML 元素,封裝可重用的代碼,下面通過本文重點(diǎn)給大家介紹vue 創(chuàng)建組件及組件使用方法,感興趣的朋友一起看看吧
    2017-07-07
  • vue 添加vux的代碼講解

    vue 添加vux的代碼講解

    通過命令npm install vux --save添加vux,在相關(guān)配置文件中配置信息,具體代碼添加方法,大家參考下本文
    2017-11-11
  • vue 解決移動(dòng)端彈出鍵盤導(dǎo)致頁面fixed布局錯(cuò)亂的問題

    vue 解決移動(dòng)端彈出鍵盤導(dǎo)致頁面fixed布局錯(cuò)亂的問題

    今天小編就為大家分享一篇vue 解決移動(dòng)端彈出鍵盤導(dǎo)致頁面fixed布局錯(cuò)亂的問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-11-11
  • vue?@tap事件之$event用法介紹

    vue?@tap事件之$event用法介紹

    這篇文章主要介紹了vue?@tap事件之$event用法介紹,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • vue打開其他項(xiàng)目頁面并傳入數(shù)據(jù)詳解

    vue打開其他項(xiàng)目頁面并傳入數(shù)據(jù)詳解

    這篇文章主要給大家介紹了關(guān)于vue打開其他項(xiàng)目頁面并傳入數(shù)據(jù)的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • Vue實(shí)現(xiàn)文件上傳和下載功能

    Vue實(shí)現(xiàn)文件上傳和下載功能

    這篇文章主要為大家詳細(xì)介紹了Vue實(shí)現(xiàn)文件上傳和下載功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • vue多級(jí)多選菜單組件開發(fā)

    vue多級(jí)多選菜單組件開發(fā)

    這篇文章主要為大家分享了vue多級(jí)多選菜單組件開發(fā)案例,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-10-10
  • vue3.0列表頁面做緩存的方法代碼

    vue3.0列表頁面做緩存的方法代碼

    很多時(shí)候?yàn)榱俗屘岣哂脩舻捏w驗(yàn)感,在頁面上添加緩存,是十分有必要的,?下面這篇文章主要給大家介紹了關(guān)于vue3.0列表頁面做緩存的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-04-04

最新評(píng)論

伊金霍洛旗| 敦化市| 丰顺县| 英超| 东丽区| 资源县| 尉犁县| 淳化县| 文登市| 顺昌县| 连城县| 福海县| 外汇| 九龙城区| 包头市| 宾阳县| 昭通市| 高州市| 白银市| 项城市| 蒲江县| 子长县| 隆尧县| 辽阳市| 通州市| 茶陵县| 武宣县| 广水市| 黔西县| 新闻| 历史| 神农架林区| 吴川市| 洮南市| 裕民县| 双牌县| 衡南县| 朔州市| 化州市| 唐山市| 教育|