Last active
May 15, 2020 16:27
-
-
Save oeway/da144deb4619b693c81395e2603449af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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