vue-photo-preview icon indicating copy to clipboard operation
vue-photo-preview copied to clipboard

增加 appendToEl

Open Lin-Kangjing opened this issue 1 year ago • 0 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/vue-photo-preview/src/lib/index.js b/node_modules/vue-photo-preview/src/lib/index.js
index 67ec150..447ce10 100644
--- a/node_modules/vue-photo-preview/src/lib/index.js
+++ b/node_modules/vue-photo-preview/src/lib/index.js
@@ -8,7 +8,12 @@ var vuePhotoPreview ={
         var opts=opts||{}
         if (!$preview) {
             $preview = new Preview({el: document.createElement('div')})
-			document.body.appendChild($preview.$el)
+						if(opts.appendToEl){
+							opts.appendToEl.appendChild($preview.$el)
+						}else{
+							document.body.appendChild($preview.$el)
+						}
+			
 		}
 		let eventName,eventCallback
 		Vue.prototype.$preview={

This issue body was partially generated by patch-package.

Lin-Kangjing avatar Jun 01 '23 09:06 Lin-Kangjing