「Javascript/vue/vuepress」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→サイトデザインなど変更) |
(→カスタム変数用意) |
||
(同じ利用者による、間の7版が非表示) | |||
行6: | 行6: | ||
.vuepress/config.js | .vuepress/config.js | ||
− | + | ==カスタム変数用意== | |
− | + | .vuepress/scripts/string.js | |
+ | <pre> | ||
+ | const string = { | ||
+ | example: { | ||
+ | mail: "hoge@example.com" | ||
+ | } | ||
+ | } | ||
+ | export default { | ||
+ | computed: { | ||
+ | $string () { | ||
+ | return string | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | .vuepress/enhanceApp.js | ||
+ | <pre> | ||
+ | import strings from "./scripts/string" | ||
+ | export default ({ | ||
+ | Vue, | ||
+ | options, | ||
+ | router, | ||
+ | siteData | ||
+ | }) => { | ||
+ | Vue.mixin(strings); | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | example1.md | ||
+ | <pre> | ||
+ | ver:{{$string.example.,mail}}' | ||
+ | </pre> | ||
==参考== | ==参考== | ||
https://qiita.com/dojineko/items/aae7e6d13479e08d49fd | https://qiita.com/dojineko/items/aae7e6d13479e08d49fd |
2019年4月12日 (金) 13:22時点における版
vuepressとは
Markdownのドキュメントジェネレーター
サイトデザインなど変更
設定ファイル
.vuepress/config.js
カスタム変数用意
.vuepress/scripts/string.js
const string = { example: { mail: "hoge@example.com" } } export default { computed: { $string () { return string } } }
.vuepress/enhanceApp.js
import strings from "./scripts/string" export default ({ Vue, options, router, siteData }) => { Vue.mixin(strings); }
example1.md
ver:{{$string.example.,mail}}'