Vue.js 2.x DokuWiki コンテンツに Vuetify を実装してみる
モチベーション
以前 DokuWiki コンテンツ内に Vuetify を実装したところ、Bootstrap3 の CSS が邪魔して、上手く表示できませんでした。
作戦
今回は Vuetify のコンテンツを DokuWiki コードブロックに記述し、HTML 埋め込み内の iframe でロードしてみてはどうか?という作戦です。
なお、このコードブロックの HTML をブラウザでインライン表示するためには、 DokuWiki コードブロックのダウンロードリンクに mime-type を指定する の修正が必要です。
コードブロック
- vuetify_sample.html
<!DOCTYPE html> <html> <head> <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"> </head> <body> <div id="app"> <v-app> <v-main> <v-container> <v-row justify="center"> <v-date-picker v-model="picker"></v-date-picker> </v-row> </v-container> </v-main> </v-app> </div> <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script> <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script> <script> new Vue({ el: '#app', vuetify: new Vuetify(), data: { picker: new Date().toISOString().substr(0, 10), } }) </script> </body> </html>
iframe での呼び出し実装
上手く行きそうです。
<html>
<iframe id=“inlineFrameExample”
title="Inline Frame Example" width="100%" height="400px" scrolling="no" frameborder="no" src="/_export/code/vuejs/vue2/implement_vuetify?codeblock=0">
</iframe>
</html>
<html><style>
h2.page-header {
font-weight: 600; font-size: 2.4rem; position: relative; padding: 10px 0 10px 16px; margin-top: 3rem !important; margin-bottom: 2rem !important;
}
h2:before {
content: ""; position: absolute; top: 0; left: 0; width: 6px; height: 100%; background: #ccc;
}
div#disqus__thread {
width: 100% !important;
}
</style></html>