优化当传入参数为 null 时报错的问题

This commit is contained in:
FungLeo 2020-05-08 10:39:04 +08:00
parent 7e84df37bd
commit 220d760d7b
4 changed files with 4 additions and 4 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ Thumbs.db
.vscode .vscode
.idea .idea
/docs/.vuepress/dist/ /docs/.vuepress/dist/
package-lock.json

View File

@ -23,7 +23,7 @@
}, },
data: function () { data: function () {
return { return {
val: '' val: null
} }
}, },
methods: { methods: {

View File

@ -25,10 +25,9 @@ export default {
}, },
methods: { methods: {
init() {// 初始化 init() {// 初始化
this.currentValue = this.value;
this.themeName = this.theme; this.themeName = this.theme;
this.preview = this.isPreview; this.preview = this.isPreview;
this.currentValue = this.value; this.currentValue = this.value || '';
if (this.isPreview) { if (this.isPreview) {
return; return;
} }

View File

@ -14,7 +14,7 @@ export default {
}, },
methods: { methods: {
init() { init() {
this.currentValue = this.value; this.currentValue = this.value || '';
this.themeName = this.theme; this.themeName = this.theme;
this.preview = this.isPreview; this.preview = this.isPreview;
if (this.isPreview) { if (this.isPreview) {