perf: 优化 pr 代码
This commit is contained in:
15
src/main.ts
15
src/main.ts
@@ -1,26 +1,19 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import { setupDirectives } from './directives'
|
||||
import { setupAssets } from '@/plugins'
|
||||
import { setupStore } from '@/store'
|
||||
import { setupRouter } from '@/router'
|
||||
import hljs from 'highlight.js'
|
||||
import "highlight.js/styles/xcode.css"
|
||||
|
||||
async function bootstrap() {
|
||||
const app = createApp(App)
|
||||
setupAssets()
|
||||
|
||||
setupStore(app)
|
||||
|
||||
await setupRouter(app)
|
||||
setupDirectives(app)
|
||||
|
||||
let regexp = /^(?:\s{4}|\t).+/gm
|
||||
app.directive('hljs', {
|
||||
mounted: (el: HTMLElement) => {
|
||||
if (el.textContent?.indexOf(" = ") != -1 || el.textContent.match(regexp)) {
|
||||
hljs.highlightBlock(el)
|
||||
}
|
||||
}
|
||||
})
|
||||
await setupRouter(app)
|
||||
|
||||
app.mount('#app')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user