Shion のもくログ(旧: Shion の技術メモ)

使った技術のメモや、うまくいかなかった事とかを綴ります

PR

2023/02/18 ~ 2023/02/24 のもくもく日記

もくもく 前回までは

2023/02/11 ~ 2023/02/17 のもくもく日記 をご覧ください。

途中経過

その1

Pure.csspure-menu-selectedVue.js 3.x のRouterLink を組み合わせるには、Vue Router の公式ドキュメント が参考になり……そう?

試しに書いてみたら、行けたかも。

<nav>
    <div class="pure-menu">
        <ul class="pure-menu-list">
            <template v-for="item in router.getRoutes()" :key="item.path">
                <RouterLink :to="item.path" v-slot="{ href, route, navigate, isActive, isExactActive }">
                    <li class="pure-menu-item" :class="[isActive && 'pure-menu-selected router-link-active', isExactActive && 'router-link-exact-active']">
                        <a :href="href" @click="navigate" class="pure-menu-link">{{ route.name }}</a>
                    </li>
                </RouterLink>
            </template>
        </ul>
    </div>
</nav>

その2

その3

そういえばJavaScript でCSS のmedia query を判定できるんだったw

mql = window.matchMedia(mediaQueryString)

参考文献

その4

VSCode WebView では、VSCode のTheme 色を、CSS 変数として利用できるらしい👀

code {
  color: var(--vscode-editor-foreground);
}

参考文献

その5

Vue.js 3.x で、グローバル変数を定義した後に、実際に利用する方法は、これが参考になった👀

<script setup>
    import { getCurrentInstance } from 'vue'

    const app = getCurrentInstance()
    const $store = app.appContext.config.globalProperties.$store

    console.log($store)
</script>

参考文献

今回の成果

※関連Tweet
PR