diff --git a/docs/package.json b/docs/package.json index c2a29ebf..67874d0e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -17,6 +17,7 @@ "globby": "^11.0.0", "gridsome": "0.7.23", "gridsome-plugin-simple-analytics": "^1.1.0", + "iframe-resizer": "^4.3.1", "portal-vue": "^2.1.7", "raw-loader": "^4.0.2", "react": "^17.0.1", diff --git a/docs/src/index.html b/docs/src/index.html index 0aff2f7b..3337760f 100644 --- a/docs/src/index.html +++ b/docs/src/index.html @@ -8,5 +8,6 @@ ${app} ${scripts} + diff --git a/docs/src/main.js b/docs/src/main.js index ebe38797..00cace32 100644 --- a/docs/src/main.js +++ b/docs/src/main.js @@ -3,6 +3,7 @@ import 'prismjs/components/prism-jsx.js' import 'prismjs/components/prism-typescript.js' import 'prismjs/components/prism-scss.js' import PortalVue from 'portal-vue' +import iframeResize from 'iframe-resizer/js/iframeResizer' import App from '~/layouts/App' Prism.manual = true @@ -20,6 +21,16 @@ export default function (Vue, { head }) { } Vue.use(PortalVue) + + Vue.directive('resize', { + bind(el, { value = {} }) { + el.addEventListener('load', () => iframeResize(value, el)) + }, + unbind(el) { + el.iFrameResizer.removeListeners() + }, + }) + Vue.component('Layout', App) Vue.component('Demo', () => import(/* webpackChunkName: "demo" */ '~/components/Demo')) Vue.component('LiveDemo', () => import(/* webpackChunkName: "live-demo" */ '~/components/LiveDemo')) diff --git a/docs/src/pages/index.vue b/docs/src/pages/index.vue index 2ebcb7c5..f6f4d6da 100644 --- a/docs/src/pages/index.vue +++ b/docs/src/pages/index.vue @@ -13,6 +13,14 @@ +