我的应用程序有两个流程,一个是用户端,另一个是管理端。我的用户端是响应式的,所以我想要元标记说,<meta name="viewport" content="width=device-width, initial-scale=1" />而我的管理端没有响应式,所以我想强制浏览器以桌面模式打开,这需要这个元标记是这样的<meta name="viewport" content="width=1024" />
我正在使用react-document-meta以下对象
const metaUser = {
title: "User meta tags",
description: "Basically make the application responsive when on user side",
meta: {
name: { keywords: "viewport" },
content: "width=device-width, initial-scale=1",
},
};
const metaAdmin = {
title: "Admin meta tags",
description: "Make the application default in desktop mode",
meta: {
name: { keywords: "viewport" },
content: "width=1024",
},
};
Run Code Online (Sandbox Code Playgroud)
但它在 head 标签上创建了新的元,并且这些标签不起作用
所以我有一个项目,我已经设置了一些预定义的规则,其中包括如果用户经过身份验证则允许读取数据库,然后允许一些我不太了解的单独的内容,但是当我将 stripe 集成到我的 firebase 中时,stripe 要求我添加这些内容在我的消防规则中。
现在我想让每个人都可以阅读一个特定的集合及其一个子集合,但我无法做到这一点
在我的规则是这样之前
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if
request.auth != null;
}
}
match /databases/{database}/documents {
match /users/{uid} {
allow read: if request.auth.uid == uid;
match /checkout_sessions/{id} {
allow read, write: if request.auth.uid == uid;
}
match /subscriptions/{id} {
allow read: if request.auth.uid == uid;
}
}
match /products/{id} {
allow read: if true;
match /prices/{id} {
allow read: if true;
}
match /tax_rates/{id} { …Run Code Online (Sandbox Code Playgroud) 我正在尝试捕获一个带有画布的 div。它是一个 T 恤编辑器。现在我用 html2canvas 捕获这个 div,然后使用 jspdf 将其打印为 pdf。现在的问题是捕获的图像质量非常低并且模糊。它的 dpi 非常低。
这是原始的div图片:
这是该 div 的打印版本:
您可以看到它们之间的质量差异是巨大的。
无论如何,这是捕获 div 然后将其转换为 pdf 的代码
var myimage;
function print() {
window.scrollTo(0, 0);
html2canvas(document.getElementById('shirtDiv')).then(function(canvas) {
myimage = canvas.toDataURL("image/jpeg");
setTimeout(print2, 1);
var doc = new jsPDF();
doc.addImage(myimage, 'JPEG', 35, 20, 130, 155);
doc.save('Test.pdf');
});
}
<div id="shirtDiv" class="page" style="width: 530px; height: 630px; position: relative; background-color: rgb(255, 255, 255); " >
<img name="tshirtview" id="tshirtFacing" src="img/crew_front.png">
<div id="drawingArea" style="position: absolute;top: 100px;left: 160px;z-index: 10;width: 200px;height: 400px;">
</div></div>
Run Code Online (Sandbox Code Playgroud)
请忽略在线CSS
javascript ×2
fabricjs ×1
html ×1
html2canvas ×1
jquery ×1
jspdf ×1
meta-tags ×1
react-dom ×1
reactjs ×1