0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

TODOYOURCD

Last updated at Posted at 2025-04-17
qiita.rb

sdfdsfds
-----------------------
import tpl from './option-card.html?raw';
import localCss from './option-card.css?raw';
import commonCss from '../css/common.css?raw';

function sheet(c){const s=new CSSStyleSheet();s.replaceSync(c);return s;}
const shared=sheet(commonCss);

export class OptionCard extends HTMLElement{
    _data=null;
    constructor(){
        super();
        this.attachShadow({mode:'open'});
        this.shadowRoot!.innerHTML=tpl;this.shadowRoot!.adoptedStyleSheets=[shared,sheet(localCss)];
    }
set data(v){
    this._data=v;this.render();
}
render(){
    if(!this._data)return;
    const r=this.shadowRoot!;
    r.querySelector('.title').textContent=this._data.title;r.querySelector('.desc').textContent=this._data.desc;
}}

if(!customElements.get('option-card'))customElements.define('option-card',OptionCard);

export type OptionData = {title:string,desc:string};




0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?