feat: add mountComponent utils

This commit is contained in:
chenjiahan
2020-08-31 17:49:19 +08:00
parent 77613e3ee5
commit f02afd882c
5 changed files with 34 additions and 32 deletions
+4 -7
View File
@@ -1,6 +1,6 @@
import { createApp, nextTick } from 'vue';
import { nextTick } from 'vue';
import { inBrowser, mountComponent } from '../utils';
import VanImagePreview from './ImagePreview';
import { inBrowser } from '../utils';
let instance;
@@ -26,10 +26,7 @@ const defaultConfig = {
};
function initInstance() {
const root = document.createElement('div');
document.body.appendChild(root);
instance = createApp({
({ instance } = mountComponent({
data() {
return {
props: {
@@ -62,7 +59,7 @@ function initInstance() {
/>
);
},
}).mount(root);
}));
}
const ImagePreview = (images, startPosition = 0) => {