全部
技术
PHP
MySQL
前端
Linux
JAVA
工具
纪念日计算器
邮记星
个人记账
笔记侠
历史上的今天
生日密码
生日书
生日密码
生日花语
博古通今
三十六计
鬼谷子
笑林广记
本草纲目
山海经
唐诗宋词
宋词300首
唐诗300首
退出
登录
注册
编辑文章
选择分类
PHP
MySQL
前端
Linux
Java
工具
选择专栏
设计模式
java基础
Angular学习
Java面试题
描述:
angluar 使用markdown编辑器vditor
封面图上传 :
+
点击上传图片
# angluar 使用markdown编辑器vditor 1. npm 安装 ```js npm install vditor --save --force ``` 2. angular.json引入样式文件**node_modules/vditor/src/assets/less/index.less** ```js "styles": [ "node_modules/vditor/src/assets/less/index.less", ] ``` 3. component.ts中导入vditor ```js import { Component, OnInit } from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import Vditor from 'vditor'; @Component({ selector: 'app-article-detail', templateUrl: './article-detail.component.html', styleUrls: ['./article-detail.component.less'], }) export class ArticleDetailComponent implements OnInit { vditor: Vditor; constructor(private activatedRoute: ActivatedRoute) { } ngOnInit() { this.vditor = new Vditor('vditor', { height: 360, //"dark" | "light" mode: "wysiwyg", theme: "dark", toolbarConfig: { pin: true, }, cache: { enable: false, }, after: () => { this.vditor.setValue('Hello, Vditor + Angular!'); } }); } } ``` 4. html中 ```html
``` 5. 完成
保存文章