Skip to content

Commit d162fde

Browse files
authored
beforeUpdate Error when using dynamic content (#25)
1 parent 6de47e3 commit d162fde

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dist/vue-code-highlight.min.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,11 @@ var vueCodeHighlight = (function (exports) {
788788
},
789789

790790
beforeUpdate: function beforeUpdate() {
791-
var newText = this.$slots.default[0].text.replace(/^[\r\n\s]*|[\r\n\s]*$/g, '');
792-
this.$el.querySelector('code').textContent = newText;
793-
Prism.highlightAllUnder(this.$refs.codeBlock);
791+
if(this.$slots.default[0].text){
792+
var newText = this.$slots.default[0].text.replace(/^[\r\n\s]*|[\r\n\s]*$/g, '');
793+
this.$el.querySelector('code').textContent = newText;
794+
Prism.highlightAllUnder(this.$refs.codeBlock);
795+
}
794796
},
795797
};
796798

0 commit comments

Comments
 (0)