fix:修复initialValue为undefined时报错的问题

This commit is contained in:
zhaoxh 2019-07-26 08:49:03 +08:00
parent 9ac3606f83
commit 952d702fff
11 changed files with 16 additions and 8 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ yarn-error.log
*.njsproj
*.sln
/build/
.vscode/

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"jumpToAliasFile.alias": {
"vue$": "vue/dist/vue.esm.js"
}
}

View File

@ -4,7 +4,6 @@
GitHub :[https://github.com/zhaoxuhui1122/vue-markdown]( https://github.com/zhaoxuhui1122/vue-markdown)
### 1.简介
**一款使用marked和highlight.js开发的一款markdown编辑器目前只支持在vue项目中使用。**

2
dist/build.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/build.js.gz vendored

Binary file not shown.

2
dist/build.js.map vendored

File diff suppressed because one or more lines are too long

BIN
dist/build.js.map.gz vendored

Binary file not shown.

View File

@ -1,7 +1,7 @@
{
"name": "vue-meditor",
"description": "一款使用marked和highlight.js开发的一款markdown编辑器",
"version": "1.3.0",
"version": "1.3.1",
"author": "zhaoxuhui<1258835133@qq.com>",
"license": "MIT",
"main": "build/index.js",

View File

@ -39,6 +39,7 @@
setTimeout(() => {
this.initialValue = doc;
}, 1000);
}
};

View File

@ -4,7 +4,6 @@ export default `# vue-Markdown编辑器
GitHub :[https://github.com/zhaoxuhui1122/vue-markdown]( https://github.com/zhaoxuhui1122/vue-markdown)
### 1.简介
**一款使用marked和highlight.js开发的一款markdown编辑器目前只支持在vue项目中使用**

View File

@ -24,7 +24,10 @@ marked.setOptions({
export default {
name: 'markdown',
props: {
initialValue: String, // 初始化内容
initialValue: {
type:String,
default:''
}, // 初始化内容
theme: { // 默认主题
type: String,
default: 'Light'
@ -412,7 +415,7 @@ export default {
e.target.value = '';
}
},
addImageClickLintener() { // 监听查看大图
addImageClickListener() { // 监听查看大图
const {
imgs
} = this;
@ -465,7 +468,7 @@ export default {
const height3 = this.$refs.preview.scrollHeight;
this.scrollHeight = Math.max(height1, height2, height3);
this.indexLenth = parseInt(this.scrollHeight / 22, 0) - 1;
this.addImageClickLintener();
this.addImageClickListener();
},
theme() {
this.themeName = this.theme;