fix:解决初始化值initialValue无法动态改变的问题
This commit is contained in:
parent
b0d4986d42
commit
214bae06f6
@ -141,3 +141,7 @@ v0.8.0
|
|||||||
1.新增md文件导出和读取功能
|
1.新增md文件导出和读取功能
|
||||||
2.修改预览部分样式
|
2.修改预览部分样式
|
||||||
3.修改头部菜单样式
|
3.修改头部菜单样式
|
||||||
|
|
||||||
|
v0.9.3
|
||||||
|
1.解决初始化值initialValue无法动态改变的问题
|
||||||
|
2.修改了打包配置
|
||||||
|
BIN
build/iconfont.eot
Normal file
BIN
build/iconfont.eot
Normal file
Binary file not shown.
116
build/iconfont.svg
Normal file
116
build/iconfont.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 49 KiB |
BIN
build/iconfont.ttf
Normal file
BIN
build/iconfont.ttf
Normal file
Binary file not shown.
1272
build/index.js
Normal file
1272
build/index.js
Normal file
File diff suppressed because one or more lines are too long
7
dist/build.js
vendored
Normal file
7
dist/build.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/build.js.map
vendored
Normal file
1
dist/build.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-meditor",
|
"name": "vue-meditor",
|
||||||
"description": "一款使用marked和highlight.js开发的一款markdown编辑器",
|
"description": "一款使用marked和highlight.js开发的一款markdown编辑器",
|
||||||
"version": "0.9.2",
|
"version": "0.9.3",
|
||||||
"author": "zhaoxuhui<1258835133@qq.com>",
|
"author": "zhaoxuhui<1258835133@qq.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -12,7 +12,8 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
|
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
|
||||||
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
|
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
|
||||||
|
"build:npm": "cross-env NODE_ENV=npm webpack --progress --hide-modules"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"highlight.js": "^9.12.0",
|
"highlight.js": "^9.12.0",
|
||||||
|
25
src/App.vue
25
src/App.vue
@ -1,35 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<mark-down @on-save="save" theme="OneDark" ></mark-down>
|
<mark-down @on-save="save" theme="OneDark" :initialValue="initialValue"></mark-down>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MarkDown from './markdown/index' // 开发文件
|
// import MarkDown from './markdown/index' // 开发文件
|
||||||
// import MarkDown from '../dist' // 引入打包好的文件
|
import MarkDown from "../build"; // 引入打包好的文件
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: "app",
|
||||||
components: {
|
components: {
|
||||||
MarkDown
|
MarkDown
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
initialValue: ""
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods:{
|
methods: {
|
||||||
save(res){
|
save(res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.initialValue = "# vue-markdown";
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
border:1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -465,6 +465,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
||||||
value() {
|
value() {
|
||||||
clearTimeout(this.timeoutId);
|
clearTimeout(this.timeoutId);
|
||||||
this.timeoutId = setTimeout(() => {
|
this.timeoutId = setTimeout(() => {
|
||||||
@ -477,6 +478,9 @@ export default {
|
|||||||
const height_2 = this.$refs.textarea.scrollHeight;
|
const height_2 = this.$refs.textarea.scrollHeight;
|
||||||
const height_3 = this.$refs.preview.scrollHeight;
|
const height_3 = this.$refs.preview.scrollHeight;
|
||||||
this.scrollHeight = Math.max(height_1, height_2, height_3);
|
this.scrollHeight = Math.max(height_1, height_2, height_3);
|
||||||
|
},
|
||||||
|
initialValue() {
|
||||||
|
this.value = this.initialValue;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
destroyed() { // 销毁时清除定时器
|
destroyed() { // 销毁时清除定时器
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
var path = require('path')
|
var path = require('path')
|
||||||
var webpack = require('webpack')
|
var webpack = require('webpack')
|
||||||
|
const NODE_ENV = process.env.NODE_ENV;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './src/index.js', // 打包为npm包时将此处修改为 ./src/index.js
|
entry: NODE_ENV==='npm'?'./src/index.js':'./src/main.js',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, './dist'),
|
path: path.resolve(__dirname, NODE_ENV==='npm'?'./build':'./dist'),
|
||||||
publicPath: '/dist/',
|
publicPath:NODE_ENV==='npm'? '/build/':'/dist/',
|
||||||
filename: 'index.js',// 打包为npm包时将此处修改为 index.js
|
filename: NODE_ENV==='npm'?'index.js':'build.js',
|
||||||
libraryTarget: 'umd',
|
libraryTarget: 'umd',
|
||||||
library: 'markdown-vue',
|
library: 'markdown-vue',
|
||||||
umdNamedDefine: true
|
umdNamedDefine: true
|
||||||
|
Loading…
Reference in New Issue
Block a user