Vue? ??? ?????? ???? ???? ?? ??? ???? ???. ??? ?? ?? ?? ?? ??? ???? ???.
Vue?? markdown-it, vue-markdown-loader,marked,vue-markdown ?? ?? ?? ???? ?? ?? ?????? ????. ? ?????? ?? ?? ?????. ???? Marked? ?????, ?? ????? ?????? ?????.js? ???????.
???? ?? ??? ??? ????.
1. ?? ????? ??
vue ???? ??? ?? ?? ?? ?? ??? ?????.
npm install marked -save // marked 用于將markdown轉(zhuǎn)換成html npm install highlight.js -save //用于代碼高亮顯示
??? ??? ? ?? ?? package.json ?? ?? ??
2. main.js ??? ?????.js ? ???? ???? ??? ?? ?? ???? ?????.
import hljs from 'highlight.js'; import 'highlight.js/styles/atom-one-dark.css' //樣式 //創(chuàng)建v-highlight全局指令 Vue.directive('highlight',function (el) { let blocks = el.querySelectorAll('pre code'); blocks.forEach((block)=>{ hljs.highlightBlock(block) }) })
??? ?? vue?? v-highlight ?? ?? ?? ??? ??? ? ????. ?? .
3. Vue ?? ??? ??? ?? ?? ? ?? ?? ??? ?????.
?? ??? ??? ????.
<!-- 正文輸出 --> <div class="entry-content"> <div v-highlight v-html="article" id="content"></div> </div>
<script> // 將marked 引入 import { marked }from 'marked'; export default { name: 'articles', data(){ return{ article:'' } }, methods: { getPostDetail() { console.log('getPostDetail()'+this.id) fetchPostDetail(this.id).then(res => { this.postdetail=res.data // 調(diào)用marked()方法,將markdown轉(zhuǎn)換成html this.article= marked(this.postdetail.content); console.log(res.data) }).catch(err => { console.log(err) }) }, created() { //調(diào)用獲取文章內(nèi)容的接口方法 this.getPostDetail() }, } </script>
4. ?? ??
markdown ?? ?? ? ?? ?? ?? ??
??? ??? ???? ??? ????. import 'highlight.js/styles/atom-one-dark.css'
??? ?????.js/styles? ??? ???? ?? ??? ? ?? ??? ???? ?????.
? ??? Vue3? ????? ?? ???? ?? ?? ??? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

???? ????? ?? ???? ?? ?? ??(dom)? ?? ???? ???? ???. Vue?? ? ??? ?? ?? ?? ??? v-if ???? ???? ????. Vue2??? v-if ??? ???? ?? DOM? ?? ????? ? ??? ? ? ?? ??? ?? ?? ????. ?? ???? ?? ??? ? ?? ? ? ?? ?? ???? ??? ?? ?? ??? ? ????. ? ?? ???? beforeRouteEnter ??. ?? ??? ?? Vue3.X?? ?? ?? ??? ???? ??? ?? ?? DOM? ?? ???? ?? ?? ??? ???? ?????. Vue3.X? scriptsetup ??? ?? ?? ??? ????

Vue? ??? ?????? ????? ???? ??? ???? ???. ??? ?? ?? ?? ?????? ???? ???. markdown-it, vue-markdown-loader,marked,vue-markdown ?? ?? Vue? ???? ?? ?? ?????? ?? ????. ? ?????? ?? ?? ?????. ???? Marked? ?????, ?? ????? ?????? ?????.js? ???????. ???? ?? ??? ??? ????. 1. ?? ?????? ?????. vue ?????? ?? ?? ?? ?? ?? npminstallmarked-save//marked? ???? markdown? htmlnpmins? ?????.

vue3+vite:src? require? ???? ???? ???? ???? vue3+vite? ?? ???? ???? ?????. vue3? ???? ?? require? ???? ??? ? ????. imgUrl:require(' .../assets/test.png') ? ?? vue2? typescript? require? ???? ?? ??? ????? ?? ???? ??? ??? ????. waitimport? ?????.

tinymce? ??? ??? ?? ?? ??? ??? ???????,tinymce? vue? ???? ?? ?? Vue ?? ??? ?????? ???? ????.tinymce ??? Vue? ???? ??? @tinymce/tinymce-vue? ???? ???. ?? ?? ?? ??? ?????? ??? ??? ???? ?????. ?? ?????? ?? ???? ?????? ???(???? ???? ? ?? ??). 1. ?? ???? ?????. npminstalltinymce-Snpminstall@tinymce/tinymce-vue-S2. ??? ???? ???????. 3. ???? ?? ??? ??? ??? ???? ?? ??? ???????.

?? ??? VueCropper ???? Yarnaddvue-cropper@next? ???? ????. ?? ?? ?? Vue2??? ?? ??? ???? ????? ?? ?? npm ??: ?? ????? ?????. ?????? ???? ???? ?? ?? ?????. ???? ?? ????? ?? ??? ??? ????? ?? ???. ???? import{userInfoByRequest}from'../js/api? ???? ???. ? ?? ?? ???? import{VueCropper}from'vue-cropper&

vue3+ts+axios+pinia? ???? ?? ??? ?????. 1. ?? ?????? aiXos ? pinianpmipinia? ???????--savenpminstallaxios--save2. AxiosResponse}from"axios";importaxiosfrom'axios';import{ElMess

??? Vue? React?, ?? ?? ???? ??? ??? ??, ??? ??? ?? ???? ??? ??, ??? ??? ??? ???? ? ??? ??? ?????. ??? vue? React ?? ????? ???? ???? ? ???, ?? ?? ??? ???? ?? ??? ???? ?? ?? ??, ?? ?? React? ????? ??? ? ????. ???? ?? ??? ?????. ?? ??? ?? renderfunction? ?? ?????. constDemo:FC=({msg})=>{returndemomsgis{msg}}constApp:FC=()=>{return(

1. ?? ?? 2. npmnpminstall@vueup/vue-quill@alpha--save 3. Main.js? import{QuillEditor}from'@vueup/vue-quill'import'@vueup/vue-quill/dist/vue-? ?????. quill.snow.css';app.comComponent('QuillEditor',QuillEditor) 4. ??? ??{{TiLe
