-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.ts
More file actions
31 lines (29 loc) · 886 Bytes
/
Copy pathindex.ts
File metadata and controls
31 lines (29 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import Vue from 'vue'
import shareSheetTemplate from './template/index.vue'
export default {
install () {
// 允许微信开放标签
Vue.config.ignoredElements = [
'wx-open-launch-app'
]
let vmShareSheet: any = null
Vue.prototype.$shareSheet = (options: { [key: string]: any }) => {
console.log(options)
// 如存在,则覆盖
const elementShareSheet = document.querySelector('.share-sheet')
if (elementShareSheet && vmShareSheet) {
document.body.removeChild(vmShareSheet.$el)
vmShareSheet.$destroy()
vmShareSheet = null
}
// 实例化
vmShareSheet = new Vue({
data () {
return options
},
render: createElement => createElement(shareSheetTemplate)
})
vmShareSheet.$mount(document.body.appendChild(document.createElement('div')))
}
}
}