shareMask.js
916 Bytes
import Util from "../util";
export default {
bind(el, binding) {
el.addEventListener('click', function () {
var loginpta = Util.isLogin() ? true : false;
if (!loginpta) {
window.location.href = '/v3/login?referer=' + encodeURIComponent(window.location.href);
return;
}
var rootElement = document.body;
var newElement = document.createElement("div");
newElement.setAttribute("class", "share-mask");
var img=document.createElement("img");
img.src="http://img.ichunt.com/test/images/ichunt/201904/10/b6dac89d8e471cc6cb499e1023373e0a.png";
rootElement.appendChild(newElement);
newElement.appendChild(img);
newElement.addEventListener('click',function(){
newElement.remove();
},false);
}, false);
}
}