是否有任何 Vs Code 扩展可以在 JavaScript 字符串中突出显示 HTML?
具体来说,我正在编写 Web 组件
const html = content => `
<div>
<table>
${content}
</table>
</div>
`;
class BaseTable extends HTMLElement {
constructor() {
super();
}
set content(value) {
const template = document.createElement('template');
template.innerHTML = style + html(value);
this.attachShadow({ mode: 'open' });
this.shadowRoot.appendChild(template.content.cloneNode(true));
}
}
Run Code Online (Sandbox Code Playgroud)
我想突出显示 html 常量变量中的字符串
我尝试在加载页面的正文元素后记录一些内容,但日志没有出现在控制台中。我究竟做错了什么?
const body = document.querySelector('body');
function setInitialGradient() {
console.log('Cant see this message on console');
body.style.background = `linear-gradient(to right, ${color1.value}, ${color2.value})`;
cssProperty.textContent = body.style.background + ';';
}
body.addEventListener('load', setInitialGradient);
Run Code Online (Sandbox Code Playgroud)
我想通过按 ctrl + alt + T 创建一个打开 Git bash 的快捷方式。然后,它启动 git bash。