Merge branch 'master' of github.com:bd-js/bd-js.github.io
commit
d84f0dc620
|
@ -36,6 +36,8 @@ export default {
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
let lang = this.lang
|
let lang = this.lang
|
||||||
|
let firstLoad = true
|
||||||
|
|
||||||
this.$last = this.code
|
this.$last = this.code
|
||||||
|
|
||||||
this.$view = new EditorView({
|
this.$view = new EditorView({
|
||||||
|
@ -52,8 +54,9 @@ export default {
|
||||||
// 监听代码变化
|
// 监听代码变化
|
||||||
EditorView.updateListener.of(v => {
|
EditorView.updateListener.of(v => {
|
||||||
let value = v.state.doc.toString()
|
let value = v.state.doc.toString()
|
||||||
if (!this.$last || value.trim() === this.$last) {
|
if (firstLoad || value.trim() === this.$last) {
|
||||||
this.$last = value.trim()
|
this.$last = value.trim()
|
||||||
|
firstLoad = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$last = value.trim()
|
this.$last = value.trim()
|
||||||
|
|
|
@ -55,9 +55,9 @@ export default {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.html = code.html
|
this.html = code.html || ''
|
||||||
this.js = code.js
|
this.js = code.js || ''
|
||||||
this.css = code.css
|
this.css = code.css || ''
|
||||||
this.updatePreview()
|
this.updatePreview()
|
||||||
}
|
}
|
||||||
this.$needUpdate = true
|
this.$needUpdate = true
|
||||||
|
|
|
@ -66,7 +66,7 @@ export default {
|
||||||
// _time / 2000 * 100 %
|
// _time / 2000 * 100 %
|
||||||
this.progress = ~~(_time / 10)
|
this.progress = ~~(_time / 10)
|
||||||
|
|
||||||
if (pending && _time > 1000) {
|
if (pending && _time >= 1000) {
|
||||||
this.progress = 0
|
this.progress = 0
|
||||||
let doc = this.$refs.view.contentDocument
|
let doc = this.$refs.view.contentDocument
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue