34 lines
689 B
Vue
34 lines
689 B
Vue
<template>
|
|
<div class="demo">
|
|
<markdown-editor v-model:data="data" :min-rows="8" :max-rows="20" />
|
|
|
|
<p class="status" v-text="`当前正文 ${data.length} 个字符`" />
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from "vue";
|
|
import { MarkdownEditor } from "timi-web";
|
|
|
|
const data = ref(`## 左侧编辑,右侧预览
|
|
|
|
在左侧输入 Markdown,右侧会实时渲染。
|
|
|
|
\`\`\`typescript
|
|
const message: string = "hello timi-web";
|
|
\`\`\`
|
|
|
|
容器宽度小于 650px 时预览区会自动折叠,可用工具栏切换。
|
|
`);
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.demo {
|
|
.status {
|
|
margin: .75rem 0 0;
|
|
font-size: .75rem;
|
|
color: var(--vp-c-text-2);
|
|
}
|
|
}
|
|
</style>
|