|
1 | 1 | <template>
|
2 | 2 | <div id="app">
|
3 | 3 | <header>
|
4 |
| - <h1>{{ config.name }}</h1> |
5 |
| - <div class="command">npm install --save {{ config.name }}</div> |
| 4 | + <h1>vue-file-viewer</h1> |
6 | 5 | <div class="description">{{ config.description }}</div>
|
7 | 6 | <section class="nav">
|
8 | 7 | <router-link v-for="d in routes" :key="d.path" :to="d.path">
|
|
13 | 12 | </a>
|
14 | 13 | <a @click="toggleFullscreen">切换全屏</a>
|
15 | 14 | </section>
|
| 15 | + <div |
| 16 | + class="command-container" |
| 17 | + v-if="$route.path === '/' || $route.path === '/home'" |
| 18 | + > |
| 19 | + <div class="command-title">推荐 iframe 引入方式</div> |
| 20 | + <div class="command-steps"> |
| 21 | + <div class="step"> |
| 22 | + <div class="step-title">STEP 1: 下载最新资源包</div> |
| 23 | + <div class="step-content"> |
| 24 | + <a |
| 25 | + href="https://github.com/zyl-ui/vue-file-viewer/releases" |
| 26 | + target="_blank" |
| 27 | + class="download-link" |
| 28 | + > |
| 29 | + 点此下载 releases 版本 |
| 30 | + </a> |
| 31 | + </div> |
| 32 | + </div> |
| 33 | + <div class="step"> |
| 34 | + <div class="step-title"> |
| 35 | + STEP 2: 将项目中的 vue-file-viewer 文件夹拷贝到您自己的项目公共目录(如Pubilc文件夹下) |
| 36 | + </div> |
| 37 | + </div> |
| 38 | + <div class="step"> |
| 39 | + <div class="step-title">STEP 3: iframe 引入</div> |
| 40 | + <div class="step-content code-block"> |
| 41 | + <pre> |
| 42 | +<code><iframe |
| 43 | + src="./file-viewer/index.html?fileUrl=https://file-viewer.me7.cn/fileTest/pdf.pdf" |
| 44 | + scrolling="auto" |
| 45 | + id="file-viewer" |
| 46 | + style="border:0;height: 500px;width:100%" |
| 47 | +/></code> |
| 48 | + </pre> |
| 49 | + </div> |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + </div> |
16 | 53 | </header>
|
17 | 54 |
|
18 | 55 | <router-view />
|
@@ -78,6 +115,76 @@ header {
|
78 | 115 | }
|
79 | 116 | }
|
80 | 117 |
|
| 118 | +.command-container { |
| 119 | + max-width: 700px; |
| 120 | + margin: 20px auto; |
| 121 | + background: color.scale(var.$primary-color, $lightness: -20%); |
| 122 | + border-radius: 6px; |
| 123 | + padding: 16px; |
| 124 | + color: white; |
| 125 | +
|
| 126 | + .command-title { |
| 127 | + font-size: 18px; |
| 128 | + font-weight: bold; |
| 129 | + text-align: center; |
| 130 | + margin-bottom: 16px; |
| 131 | + border-bottom: 1px solid rgba(255, 255, 255, 0.2); |
| 132 | + padding-bottom: 8px; |
| 133 | + } |
| 134 | +
|
| 135 | + .command-steps { |
| 136 | + .step { |
| 137 | + margin-bottom: 14px; |
| 138 | +
|
| 139 | + .step-title { |
| 140 | + font-weight: bold; |
| 141 | + margin-bottom: 8px; |
| 142 | + } |
| 143 | +
|
| 144 | + .step-content { |
| 145 | + background: rgba(0, 0, 0, 0.2); |
| 146 | + border-radius: 4px; |
| 147 | + padding: 10px; |
| 148 | + } |
| 149 | +
|
| 150 | + .download-link { |
| 151 | + color: #fff; |
| 152 | + text-decoration: underline; |
| 153 | +
|
| 154 | + &:hover { |
| 155 | + color: color.scale(var.$primary-color, $lightness: 80%); |
| 156 | + } |
| 157 | + } |
| 158 | +
|
| 159 | + .code-block { |
| 160 | + pre { |
| 161 | + margin: 0; |
| 162 | + overflow-x: auto; |
| 163 | +
|
| 164 | + code { |
| 165 | + white-space: pre; |
| 166 | + font-family: monospace; |
| 167 | + font-size: 14px; |
| 168 | + line-height: 1.5; |
| 169 | + } |
| 170 | + } |
| 171 | + } |
| 172 | + } |
| 173 | + } |
| 174 | +} |
| 175 | +
|
| 176 | +.command { |
| 177 | + background: color.scale(var.$primary-color, $lightness: -20%); |
| 178 | + color: white; |
| 179 | + font-family: monospace; |
| 180 | + max-width: 500px; |
| 181 | + margin: 12px auto; |
| 182 | + border-radius: 2px; |
| 183 | + padding: 12px 24px; |
| 184 | + box-sizing: border-box; |
| 185 | + text-align: center; |
| 186 | +} |
| 187 | +
|
81 | 188 | .page-content {
|
82 | 189 | max-width: 1000px;
|
83 | 190 | margin: 0 auto;
|
@@ -147,18 +254,6 @@ a:hover {
|
147 | 254 | color: color.scale(var.$primary-color, $lightness: 20%);
|
148 | 255 | }
|
149 | 256 |
|
150 |
| -.command { |
151 |
| - background: color.scale(var.$primary-color, $lightness: -20%); |
152 |
| - color: white; |
153 |
| - font-family: monospace; |
154 |
| - max-width: 500px; |
155 |
| - margin: 12px auto; |
156 |
| - border-radius: 2px; |
157 |
| - padding: 12px 24px; |
158 |
| - box-sizing: border-box; |
159 |
| - text-align: center; |
160 |
| -} |
161 |
| -
|
162 | 257 | .description {
|
163 | 258 | color: white;
|
164 | 259 | font-size: 15px;
|
|
0 commit comments