Skip to content

Instantly share code, notes, and snippets.

@oeway
Last active May 15, 2020 16:27
Show Gist options
  • Save oeway/da144deb4619b693c81395e2603449af to your computer and use it in GitHub Desktop.
Save oeway/da144deb4619b693c81395e2603449af to your computer and use it in GitHub Desktop.
(function($) {
$.getStylesheet = function (href) {
var $d = $.Deferred();
var $link = $('<link/>', {
rel: 'stylesheet',
type: 'text/css',
href: href
}).appendTo('head');
$d.resolve($link);
return $d.promise();
};
})(jQuery);
$.getStylesheet('https://cdn.jsdelivr.net/npm/[email protected]/dist/styles.css')
require([
'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js',
"https://cdn.jsdelivr.net/npm/[email protected]/dist/index.js"
],function(imjoyLoader, Vue, vuejsmodal){
Vue.use(vuejsmodal.default)
var elem = document.createElement('div');
elem.id = 'app';
elem.innerHTML = `
<button class="btn" @click="show()">Show</button>
<modal name="hello-world">
hello, world!
</modal>
`
document.getElementById('maintoolbar').appendChild(elem);
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
},
methods: {
show () {
this.$modal.show('hello-world');
},
hide () {
this.$modal.hide('hello-world');
}
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment