2021-07-14から1日間の記事一覧

【CSS】上書きを回避する方法

CSS

:not を使用してCSSの上書きを回避する。 // bad .item-item { margin-bottom: 20px; &:last-child { margin-bottom: 0; } } // good .list-item { &:not(:last-child) { margin-bottom: 20px; } }

【Nuxt.js】エラーページへ遷移させる方法

this.$nuxt.error(); 引数として、statusCodeとmessageを指定することが出来る。 this.$nuxt.error({ statusCode: 404, message: 'エラーが発生しました。', });

【TypeScript】オブジェクトのvalueをストリングリテラルタイプにする方法

const obj = { a: 'c', b: 'd', }; type Keys = keyof typeof obj; type Values = typeof obj[Keys] // 'c' | 'd';