Skip to content

Commit

Permalink
fix:修复initialValue为undefined时报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoxh committed Jul 26, 2019
1 parent 9ac3606 commit 952d702
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ yarn-error.log
*.njsproj
*.sln
/build/
.vscode/
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"jumpToAliasFile.alias": {
"vue$": "vue/dist/vue.esm.js"
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

GitHub :[https://github.com/zhaoxuhui1122/vue-markdown]( https://github.com/zhaoxuhui1122/vue-markdown)


### 1.简介

**一款使用marked和highlight.js开发的一款markdown编辑器,目前只支持在vue项目中使用。**
Expand Down
2 changes: 1 addition & 1 deletion dist/build.js

Large diffs are not rendered by default.

Binary file modified dist/build.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/build.js.map

Large diffs are not rendered by default.

Binary file modified dist/build.js.map.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
setTimeout(() => {
this.initialValue = doc;
}, 1000);
}
};
Expand Down
1 change: 0 additions & 1 deletion src/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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项目中使用。**
Expand Down
9 changes: 6 additions & 3 deletions src/markdown/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ marked.setOptions({
export default {
name: 'markdown',
props: {
initialValue: String, // 初始化内容
initialValue: {
type:String,
default:''
}, // 初始化内容
theme: { // 默认主题
type: String,
default: 'Light'
Expand Down Expand Up @@ -412,7 +415,7 @@ export default {
e.target.value = '';
}
},
addImageClickLintener() { // 监听查看大图
addImageClickListener() { // 监听查看大图
const {
imgs
} = this;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 952d702

Please sign in to comment.