因项目工作需要,目前在研究前端的一些知识。主要想实现一个类似于webstorm,可以实现对本地文件进行增删改查等操作的IDE。下面通过几个专题,循序渐进,对某一些部分进行总结,希望能对你有帮助。(网上资料太多太杂,适合自己的还是需要自己去理解~~~)

  1. vue-cli脚手架的简单介绍、安装等
  2. element-ui框架简单介绍
  3. vue-cli element-ui融合
  4. 富文本编辑器在前端页面的使用—AceEditor
  5. vue-cli简单集成codemirror编辑器
  6. 基于electron-vue二次开发

0. 前端笔记

  • 下面附上对于初学者友好的html、css、js教程链接:

  1. HTML(菜鸟教程):http://www.runoob.com/html/html-tutorial.html
  2. CSS(菜鸟教程):http://www.runoob.com/css/css-tutorial.html
  3. JS(菜鸟教程):http://www.runoob.com/js/js-tutorial.html
  • 注释:

  1. html的注释代码格式: <!--你的代码块-->,可以单行注释,也可以注释多行;
  2. css的注释代码格式: /* 你的css */,多数情况下也是用于说明,
  3. js的注释格式: // 你的js代码; 可以用于说明你当前代码的用途啊、作用啊等等~;js还能注释多行代码,格式跟css注释一样:/* 你的js */;

1. vue-cli脚手架的简单介绍、安装等

  • 安装:

  1. 前提是需要保证有node的环境
  2. npm install webpack -g  (安装webpack打包工具,webpack -v)
  3. npm install -g vue-cli  (安装vue-cli脚手架,vue -v)
  4. vue init webpack my-project  (创建了my-project目录结构)
  5. cd my-project
  6. 安装项目依赖 npm install
  7. 启动项目 npm run dev
  • 官方教程:

https://cn.vuejs.org/v2/guide/

2. element-ui框架简单介绍

  • 安装element-ui

npm i element-ui --save

  • 开始使用

参照element-ui官方文档:http://element.eleme.io/#/zh-CN/component/installation

3. vue-cli element-ui融合

  • 使用:

1. 在入口main.js文件中引入element-ui模块(前提是需要先安装好)

 ……
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; Vue.use(ElementUI);
……

2. 在xxx.vue文件中<template></template>部分,需要使用的地方引入element-ui组件;<script></script>;<style></style>:

 <template>
<div class="body">
<div>
<el-button @click="showDirDialog" plain>打开</el-button>
</div>
<el-container>
<!--顶部栏-->
<el-header height="50px">header</el-header>
<el-container>
<!--左侧侧边栏-->
<el-aside width="300px">
<el-tree ref="dirTree" :data="dirTree" :props="defaultProps" :load="loadSubFile" lazy
@node-click="treeNodeClick"></el-tree>
</el-aside>
<!--主-->
<el-main>
<!--编辑器-->
<codemirror :value="code" :options="cmOptions"></codemirror>
</el-main>
</el-container>
</el-container>
</div>
</template>

4. 富文本编辑器在前端页面的使用—AceEditor

  • 什么是富文本编辑器?

富文本编辑器,是一种可内嵌于浏览器,所见即所得的文本编辑器。富文本编辑器不同于文本编辑器,可到网上下载免费的富文本编辑器内嵌于自己的网站或程序里,方便用户编辑文章或信息。比较常用的是:kindeditor、aceEditor、UEditor、Codemirror等。
  • AceEditor介绍与使用:

  • 简单介绍:

ACE 是一个开源的、独立的、基于浏览器的代码编辑器,可以嵌入到任何web页面或JavaScript应用程序中。ACE支持超过60种语言语法高亮,具有良好的代码提示功能和大量的主题,并能够处理代码多达400万行的大型文档。ACE开发团队称,ACE在性能和功能上可以媲美本地代码编辑器(如Sublime Text、TextMate和Vim等)。

  • 使用:

下载后,直接在项目中引用,即可(div的高度必须设置,否则不会显示出来)。示例代码如下(main.html文件):

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test_demo</title>
<script src="../src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="../src-noconflict/ext-language_tools.js" type="text/javascript"></script>
</head> <body>
<div style="height: 300px" id="editorDiv"></div>
<script>
var editor = ace.edit("editorDiv");
editor.$blockScrolling = Infinity;
//字体大小
editor.setFontSize(16);
//设置编辑器样式,对应theme-*.js文件
editor.session.setMode("ace/mode/c_cpp");
//设置代码语言,对应mode-*.js文件
editor.session.setMode("ace/mode/javascript");
//设置打印线是否显示
editor.setShowPrintMargin(false);
//设置是否只读
editor.setReadOnly(false);
//与ctrl+f功能一致,搜索
editor.execCommand('find');
//设置代码折叠
editor.getSession().setUseWrapMode(true);
//设置高亮
//editor.setHighlightActiveLine(false); //以下部分是设置输入代码提示的,如果不需要可以不用引用ext-language_tools.js
ace.require("ace/ext/language_tools");
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
editor.setTheme("ace/theme/chrome");
</script>
</body>
</html>

5. vue-cli简单集成codemirror编辑器

  • 使用:

1. 在入口main.js文件中引入codemirror模块(前提是需要先安装好)

 ……
import VueCodemirror from 'vue-codemirror';
import 'codemirror/lib/codemirror.css'; Vue.use(VueCodemirror);
……

2. 在xxx.vue文件中<template></template>部分,需要使用的地方引入codemirror:

 ……
<!--编辑器-->
<codemirror :value="code" :options="cmOptions"></codemirror>
……

3. 在xxx.vue文件中<script></script>部分,需要使用的地方引入js逻辑代码:

 import {codemirror} from 'vue-codemirror';
import "codemirror/mode/python/python.js";
import 'codemirror/addon/fold/foldcode.js';
import 'codemirror/addon/fold/foldgutter.js';
import 'codemirror/addon/fold/brace-fold.js';
import 'codemirror/addon/fold/xml-fold.js';
import 'codemirror/addon/fold/indent-fold.js';
import 'codemirror/addon/fold/markdown-fold.js';
import 'codemirror/addon/fold/comment-fold.js'; export default {
components: {
codemirror
},
data() {
return {
code: '',
cmOptions: {
tabSize: 4,
mode: 'text/javascript',
lineNumbers: true
}
}
},
mounted() {
},
methods: {
……,
displayFileData(content) {
this.code = content;
}
}
}

4. 在xxx.vue文件中<style></style>部分,需要使用的地方引入样式代码(略)

6. 基于electron-vue二次开发

  • 使用脚手架样板构建项目

  1. vue init simulatedgreg/electron-vue my-project
  2. cd my-project
  3. npm install
  4. npm run dev

(如果遇到run dev或者run build的时候出错,可能是因为国内的网络下载“electron-v1.8.3-win32-x64.zip”出错。参照我的上篇文章:https://www.cnblogs.com/sunshine-blog/p/9915222.html)

  • 使用 —>官方文档:

https://electron.org.cn/vue/index.html

https://simulatedgreg.gitbooks.io/electron-vue/content/cn/

  • 实际例子:

可参照网上大神的项目:https://www.cnblogs.com/GoodHelper/p/8527523.html

前端_vue-cli+element-ui+AceEditor+codemirror+electron-vue的更多相关文章

  1. vue+element ui 的时间控件选择 年月日时分

    前言:工作中用到 vue+element ui 的前端框架,需要选择年月日时分,但element ui官网demo有没有,所以记录一下.转载请注明出处:https://www.cnblogs.com/ ...

  2. Vue + Element UI 实现权限管理系统 前端篇(十一):第三方图标库

    使用第三方图标库 用过Elment的同鞋都知道,Element UI提供的字体图符少之又少,实在是不够用啊,幸好现在有不少丰富的第三方图标库可用,引入也不会很麻烦. Font Awesome Font ...

  3. vue2.0+Element UI 表格前端分页和后端分页

    之前写过一篇博客,当时对element ui框架还不太了解,分页组件用 html + css 自己写的,比较麻烦,而且只提到了后端分页 (见 https://www.cnblogs.com/zdd20 ...

  4. [坑况]饿了么你是这样的前端——vue+element ui 【this dependency was not found:'element-ui/lib/theme-chalk/index.css'】

    element ui 坑况:今日pull代码,潇洒npm run dev ,被告知:this dependency was not found:'element-ui/lib/theme-chalk/ ...

  5. Vue + Element UI 实现权限管理系统 前端篇(二):Vue + Element 案例

    导入项目 打开 Visual Studio Code,File --> add Folder to Workspace,导入我们的项目. 安装 Element 安装依赖 Element 是国内饿 ...

  6. vue Cli 按需引入Element UI 和全局引用Element UI

    全局引用: 一.安装 Element UI npm i element-ui -S 二.在main.js 中引入 element UI import ElementUI from 'element-u ...

  7. 分享一个自搭的框架,使用Spring boot+Vue+Element UI

    废弃,新的:https://www.cnblogs.com/hackyo/p/10453243.html 特点:前后端分离,可遵循restful 框架:后端使用Spring boot,整合了aop.a ...

  8. element UI table 过滤 筛选问题

    一.问提描述    使用elementUI table 官方筛选案例,发现筛选不是服务器端筛选,而是浏览器端对每一页进行单独筛选. 如何在服务器端筛选? 二.查询Element UI 官网table组 ...

  9. Vue + Element UI 实现权限管理系统

    Vue + Element UI 实现权限管理系统 前端篇(一):搭建开发环境 https://www.cnblogs.com/xifengxiaoma/p/9533018.html

随机推荐

  1. curl post请求方式

    curl -l -H "application/x-www-form-urlencoded; charset=UTF-8" -X POST -d "query=SELEC ...

  2. MD5加密Java工具类

    原文:http://www.open-open.com/code/view/1421764946296 import java.security.MessageDigest; public class ...

  3. 【APUE】信号量、互斥体和自旋锁

    http://www.cnblogs.com/biyeymyhjob/archive/2012/07/21/2602015.html http://blog.chinaunix.net/uid-205 ...

  4. 【APUE】一个fork的面试题及字符设备、块设备的区别

    具体内容见:http://coolshell.cn/articles/7965.html 字符设备.块设备主要区别是:在对字符设备发出读/写请求时,实际的硬件I/O一般就紧接着发生了,而块设备则不然, ...

  5. samba.conf (香港中华厨房有限公司实例)

    # Sample configuration file for the Samba suite for Debian GNU/Linux. # # This is the main Samba con ...

  6. python爬虫(二)--了解deque

    队列-deque 有了上面一节的基础.当然你须要全然掌握上一节的全部方法,由于上一节的方法.在以下的教程中 会重复的用到. 假设你没有记住,请你返回上一节. http://blog.csdn.net/ ...

  7. Android 性能优化探究

    使用ViewStub动态载入布局.避免一些不常常的视图长期握住引用: ViewStub的一些特点: 1. ViewStub仅仅能Inflate一次,之后ViewStub对象被置空:某个被ViewStu ...

  8. Android开发之自己定义Spinner样式的效果实现(源码实现)

    android系统自带的Spinner样式是远远满足不了我们实际开发过程中对Spinner UI风格的要求,因此我们肯定须要为了切合整个应用的风格,改动我们的Spinner样式.系统给我们提供了两种常 ...

  9. Android中View窗口getWidth和getMeasuredWidth的差别

    今天在研究自己定义listview的下拉刷新的效果.想移植到项目需求中,再看自己定义源代码时发现了一个问题就是getWidth和getMeasuredWidth两个方法有什么差别,求教万能的百度,经调 ...

  10. The Pilots Brothers&#39; refrigerator-DFS路径打印

    I - The Pilots Brothers' refrigerator Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format ...