|
@@ -1,12 +1,19 @@
|
|
import Vue from 'vue'
|
|
import Vue from 'vue'
|
|
|
|
+import ElementUI from 'element-ui'
|
|
|
|
+import 'element-ui/lib/theme-chalk/index.css'
|
|
|
|
+import WisdomUI from 'wisdom-ui'
|
|
|
|
+import 'wisdom-ui/lib/theme/index.css'
|
|
import { loadScriptQueue } from '@/utils/loadScript'
|
|
import { loadScriptQueue } from '@/utils/loadScript'
|
|
import axios from 'axios'
|
|
import axios from 'axios'
|
|
import Tinymce from '@/components/tinymce/index.vue'
|
|
import Tinymce from '@/components/tinymce/index.vue'
|
|
|
|
|
|
Vue.component('tinymce', Tinymce)
|
|
Vue.component('tinymce', Tinymce)
|
|
Vue.prototype.$axios = axios
|
|
Vue.prototype.$axios = axios
|
|
|
|
+Vue.use(ElementUI, { size: 'small' })
|
|
|
|
+Vue.use(WisdomUI)
|
|
|
|
|
|
const $previewApp = document.getElementById('previewApp')
|
|
const $previewApp = document.getElementById('previewApp')
|
|
|
|
+console.log('pre', $previewApp)
|
|
const childAttrs = {
|
|
const childAttrs = {
|
|
file: '',
|
|
file: '',
|
|
dialog: ' width="600px" class="dialog-width" v-if="visible" :visible.sync="visible" :modal-append-to-body="false" '
|
|
dialog: ' width="600px" class="dialog-width" v-if="visible" :visible.sync="visible" :modal-append-to-body="false" '
|
|
@@ -31,9 +38,9 @@ function init(event) {
|
|
if (Array.isArray(code.links) && code.links.length > 0) {
|
|
if (Array.isArray(code.links) && code.links.length > 0) {
|
|
links = buildLinks(code.links)
|
|
links = buildLinks(code.links)
|
|
}
|
|
}
|
|
|
|
+ console.log('run------', code)
|
|
|
|
|
|
$previewApp.innerHTML = `${links}<style>${code.css}</style><div id="app"></div>`
|
|
$previewApp.innerHTML = `${links}<style>${code.css}</style><div id="app"></div>`
|
|
- console.log('run2', code)
|
|
|
|
if (Array.isArray(code.scripts) && code.scripts.length > 0) {
|
|
if (Array.isArray(code.scripts) && code.scripts.length > 0) {
|
|
loadScriptQueue(code.scripts, () => {
|
|
loadScriptQueue(code.scripts, () => {
|
|
newVue(attrs, code.js, code.html)
|
|
newVue(attrs, code.js, code.html)
|
|
@@ -47,7 +54,7 @@ function init(event) {
|
|
function newVue(attrs, main, html) {
|
|
function newVue(attrs, main, html) {
|
|
main = eval(`(${main})`)
|
|
main = eval(`(${main})`)
|
|
main.template = `<div>${html}</div>`
|
|
main.template = `<div>${html}</div>`
|
|
- new Vue({
|
|
|
|
|
|
+ const App = Vue.component('App', {
|
|
components: {
|
|
components: {
|
|
child: main
|
|
child: main
|
|
},
|
|
},
|
|
@@ -57,5 +64,8 @@ function newVue(attrs, main, html) {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
template: `<div><child ${attrs}/></div>`
|
|
template: `<div><child ${attrs}/></div>`
|
|
|
|
+ })
|
|
|
|
+ new Vue({
|
|
|
|
+ render: h => h(App)
|
|
}).$mount('#app')
|
|
}).$mount('#app')
|
|
}
|
|
}
|