0.0.7 • Published 4 years ago

@qunbotop/md-editor v0.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

一、安装引入

  1. 安装
npm i @qxintech/md-editor
  1. 引入样式
//  /src/index.scss
@import '/node_modules/@qxintech/md-editor/dist/style.css';
  1. 导入组件
//  /src/main.ts
import { createApp } from 'vue'
import App from './App.vue'
import { createMdEditor } from '@qxintech/md-editor';
import './index.scss'

const mdEditor = createMdEditor();

createApp(App).use(mdEditor).mount('#app')

二、组件使用

通过article来获取文本内容,readOnly来控制只读还是可编辑模式。

<template>
  <MdEditor v-model:content="article" :readOnly="readOnly"/>
  <button @click="save">保存</button>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'App',
  data() {
    return {
      // 文本内容
      article: '# 我的',
      // 是否只读
      readOnly: false
    }
  },
  watch: {
    article(val) {
      console.log(val);
    }
  },
  methods: {
    save() {
      console.log(this.article);
    }
  }
})
</script>
0.0.3

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago