"vue layout"
Bootstrap 3.0.0 Snippet by evarevirus

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html><html lang='en' class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/jakob-e/pen/qrPQga?depth=everything&order=popularity&page=3&q=vue&show_forks=false" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel='stylesheet prefetch' href='//cdnjs.cloudflare.com/ajax/libs/golden-layout/1.5.7/css/goldenlayout-base.css'><link rel='stylesheet prefetch' href='//cdnjs.cloudflare.com/ajax/libs/golden-layout/1.5.7/css/goldenlayout-dark-theme.css'> <style class="cp-pen-styles">html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; } body { margin: 0; } [id="app"] { width: 100vw; height: 100vh; color: gold; font-family: sans-serif; } [id="A"], [id="B"], [id="C"] { padding: 1rem; } h1 { font-weight: 400; } a { color: orange; } input { margin: 1rem; } button { position: absolute; bottom: 1rem; right: 1rem; } </style></head><body> <!-- Golden Layout container --> <div id="app"></div> <!-- Golden Layout templates (outside container)--> <template id="A"> <h1>{{ title }}</h1> <a href="https://www.golden-layout.com/" target="_blank">golden-layout.com</a><br> <button @click="resetLayout()">Reset Layout</button> </template> <template id="B"><input v-model="somevalue" /></template> <template id="C"><p>{{ somevalue }}<p></template> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script><script src='//cdnjs.cloudflare.com/ajax/libs/vue/2.2.2/vue.min.js'></script><script src='//cdnjs.cloudflare.com/ajax/libs/golden-layout/1.5.7/goldenlayout.min.js'></script> <script >// External JS // Vue, jQuery and Golden Layout //cdnjs.cloudflare.com/ajax/libs/vue/2.2.2/vue.min.js //cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js //cdnjs.cloudflare.com/ajax/libs/golden-layout/1.5.7/goldenlayout.min.js "use strict"; // // Shared Vue Instance Object // // As GL will break attempting to wrap it in a Vue instance // we need to create an instance for each template // // To ensure all templates are linked we create a shared // object to be used as config for each new Vue instance // var VueApp = { el: '#app', data: { title: 'Vue + Golden Layout', somevalue: 'Hello Vue :-)' }, methods: { resetLayout: function () { localStorage.removeItem('savedState'); window.location.reload(true); } } }; // // GL Config // var config = { settings: { hasHeaders: true, showPopoutIcon: false, showCloseIcon: false }, content: [{ type: 'column', content: [ { title: 'Template A', type: 'component', isClosable: false, componentName: 'template', componentState: { templateId: 'A' } }, { type: 'row', content: [ { title: 'Template B', type: 'component', isClosable: false, componentName: 'template', componentState: { templateId: 'B' } }, { title: 'Template C', type: 'component', isClosable: false, componentName: 'template', componentState: { templateId: 'C' } } ] } ] }] }; // // Load saved layout state from localstorage // If we have a saved state use this as config // var savedState = localStorage.getItem('savedState'); config = savedState !== null ? JSON.parse(savedState) : config; // // Create new GL Layout // var layout = new GoldenLayout(config, $(VueApp.el)); // Register GL templates // – add a Vue instance wrapper with the template id (A, B, C) // – add the template content to the container // – await DOM render (setTimeout) // – change the id of the VueApp to match the template // – Vueify it layout.registerComponent('template', function (container, state) { var html = "<div id=\"" + state.templateId + "\">" + $('#' + state.templateId).html() + "</div>"; container.getElement().html(html); setTimeout(function () { // VueApp.el = `#${state.templateId}`; // Update – to prevent watch, mounted etc. from // triggering once per GL template we only link // to the VueApp properties we want to shared var options = { el: "#" + state.templateId, // use data: VueApp.data, methods: VueApp.methods // shared methods }; new Vue(options); }); }); // // Save state in local storage // layout.on('stateChanged', function () { var state = JSON.stringify(layout.toConfig()); localStorage.setItem('savedState', state); }); // Initialize GL layout.init(); // Update GL on window resize window.addEventListener('resize', function () { layout.updateSize(); }); //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: