我正在开发 Imgix 的类似服务,并且正在使用 Sharp。
\n\n但Imgix的webp无损压缩比Sharp获得更好的效果。相同宽度和高度的相同图像在 Imgix 中为 453\xc2\xa0KB,而在 Sharp 中为 1.3\xc2\xa0MB。
\n\n有什么建议可以在不损失质量的情况下增加压缩吗?
\n\n我正在使用的代码:
\n\nhttps.get(url, function (response) {\n let transform = sharp().toFormat('webp').resize(width, height);\n return response.pipe(transform).webp({lossless:true}).pipe(res);\n});\nRun Code Online (Sandbox Code Playgroud)\n 我正在尝试使用 Alpine.js 实现不确定复选框
您可以选择所有复选框,但是当您尝试取消选中某些复选框时,所有复选框都将被取消选中。
看一下:https://codepen.io/nuno360/pen/gOwXpXP
<table x-data="{ allChecked: [] }"
x-init="
$watch('allChecked', value => {
if (value.length === 0) {
$refs.all.indeterminate = false;
$refs.all.checked = false
} else if (value.length == all.length) {
$refs.all.indeterminate = false;
$refs.all.checked = true
} else {
$refs.all.indeterminate = true
}
})
" class="bg-white min-w-full divide-y divide-gray-200">
<thead>
<tr>
<th scope="col" class="h-14 leading-none" width="60"><input id="all" x-ref="all" @change="allChecked = $event.target.checked ? all : []; console.log(allChecked)" type="checkbox" class="form-checkbox border-gray-300 h-5 w-5 cursor-pointer rounded"></th>
<th scope="col" class="h-14 …Run Code Online (Sandbox Code Playgroud) 我想:
SHOW DATABASES WHERE 'Database' NOT IN ('mysql', 'performance_schema', 'sys');
但mysql、performance_schema和sys出现在列表中。