來自 Luckysheet源代碼的參考:
image://css/loading.gif
這是影像協議嗎?我以前從未見過這個前綴,誰能解釋一下它是什么?
uj5u.com熱心網友回復:
不,它只是后面用來區分兩種型別值的前綴:
const luckysheetloadingImage = function (config) {
if(typeof config.image==="function"){
return config.image()
}
const regE = new RegExp("^(image|path)://");
const regResult = regE.exec(config.image);
let imageHtml = '';
if (regResult !== null) {
const prefix = regResult[0];
const type = regResult[1];
const imageStr = regResult.input.substring(prefix.length);
switch (type) {
case "image":
imageHtml = `<div style="background-image: url(${imageStr});"></div>`;
break;
我可能會使用兩個不同的屬性,而不是在字串中編碼資訊。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/342492.html
上一篇:將圖片放入乳膠中
