2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-17 09:10:33 +03:00

feat: enable onload callbacks (#414)

* refactor(examples): run ssr example from server

* chore: switch to babel for build

buble complains too much

* feat: enable loaded callbacks

feat: add skip option

* examples: add async-callback browser example

* examples: fix server

* examples(ssr): add reactive script with callback

* fix: also skip on ssr

* chore: remove unused var

* feat: only add mutationobserver if DOM is still loading

feat: disconnect mutation observer once DOM has loaded

* examples: pass vmid to loadCallback instead of el

* feat: also support load callbacks for link/style tags

* test: add unit tests for load

* test: add load e2e test

* chore: fix lint

* chore: remove unused files

* test: fix e2e load callback test

* test: fix attempt

* examples: ie9 compatiblity

destructuring doesnt work in ie9

* fix: add onload attribute on ssr

dont rely on mutationobserver

* chore: lint ci conf

* refactor: remove loadCallbackAttribute config option

test: fix coverage for load

* test: improve coverage

* fix: only use console when it exists (for ie9)

* chore: fix coverage
This commit is contained in:
Pim
2019-07-24 10:18:40 +02:00
committed by GitHub
parent 05163a77a8
commit fc71e1f1c4
49 changed files with 963 additions and 632 deletions
+7 -7
View File
@@ -6,7 +6,7 @@ Vue.use(VueMeta)
// index.html contains a manual SSR render
const app1 = new Vue({
metaInfo() {
metaInfo () {
return {
title: 'App 1 title',
bodyAttrs: {
@@ -14,15 +14,15 @@ const app1 = new Vue({
},
meta: [
{ name: 'description', content: 'Hello from app 1', vmid: 'test' },
{ name: 'og:description', content: this.ogContent }
{ name: 'og:description', content: this.ogContent }
],
script: [
{ innerHTML: 'var appId=1.1', body: true },
{ innerHTML: 'var appId=1.2', vmid: 'app-id-body' },
{ innerHTML: 'var appId=1.2', vmid: 'app-id-body' }
]
}
},
data() {
data () {
return {
ogContent: 'Hello from ssr app'
}
@@ -44,7 +44,7 @@ const app2 = new Vue({
],
script: [
{ innerHTML: 'var appId=2.1', body: true },
{ innerHTML: 'var appId=2.2', vmid: 'app-id-body', body: true },
{ innerHTML: 'var appId=2.2', vmid: 'app-id-body', body: true }
]
}),
template: `
@@ -60,7 +60,6 @@ const app3 = new Vue({
`
}).$mount('#app3')
setTimeout(() => {
console.log('trigger app 1')
app1.$data.ogContent = 'Hello from app 1'
@@ -75,8 +74,9 @@ setTimeout(() => {
console.log('trigger app 3')
app3.$meta().refresh()
}, 7500)
setTimeout(() => {
console.log('trigger app 4')
const App = Vue.extend({ template: `<div>app 4</div>` })
const app4 = new App().$mount()
new App().$mount()
}, 10000)