Skip to content

Instantly share code, notes, and snippets.

@diverted247
Last active September 17, 2016 16:00
Show Gist options
  • Save diverted247/9310aa27b0236ab03bbcb9bc547fbe70 to your computer and use it in GitHub Desktop.
Save diverted247/9310aa27b0236ab03bbcb9bc547fbe70 to your computer and use it in GitHub Desktop.
Async loading pattern for loading Vue components as modules and wiring via vLoad
//setup component to load async when used
//VLoad returns an async function(resolve, reject) {...}
//this will
Vue.component( 'arrowback' , VLoad( 'component.js' ) );
new Vue({
el: 'body',
template:"<arrowback></arrowback>"
});
define(["require", "exports"], function (require, exports) {
"use strict";
exports.component = {
template: "<svg height=\"25px\" width=\"25px\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 8 13\">\n \t<style>.st0{fill:#0000;}</style>\n\t<path class=\"st0\" d=\"M6.4 12.7L.3 6.5 6.4.2l1.3 1.3-4.9 5 4.9 4.9z\"/>\n</svg>",
data: function () {
return {};
}
};
});
export var components = {
template:
`<svg height="25px" width="25px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 13">
<style>.st0{fill:#0000;}</style>
<path class="st0" d="M6.4 12.7L.3 6.5 6.4.2l1.3 1.3-4.9 5 4.9 4.9z"/>
</svg>`,
data(){
return {};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment