mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
1 line
4.7 KiB
JavaScript
1 line
4.7 KiB
JavaScript
"use strict";(self.webpackChunkfes_js=self.webpackChunkfes_js||[]).push([[278],{4731:(n,a,s)=>{s.r(a),s.d(a,{data:()=>t});const t={key:"v-7b96e3a4",path:"/guide/public.html",title:"静态资源",lang:"zh-CN",frontmatter:{},excerpt:"",headers:[{level:3,title:"在HTML模板中使用",slug:"在html模板中使用",children:[]},{level:3,title:"在.vue 和 js 文件中使用",slug:"在-vue-和-js-文件中使用",children:[]}],filePathRelative:"guide/public.md",git:{updatedTime:1680249231e3,contributors:[{name:"wanchun",email:"445436867@qq.com",commits:1}]}}},6430:(n,a,s)=>{s.r(a),s.d(a,{default:()=>p});const t=(0,s(6252).uE)('<h1 id="静态资源" tabindex="-1"><a class="header-anchor" href="#静态资源" aria-hidden="true">#</a> 静态资源</h1><p>有些内容不需要经过 <code>webpack</code> 模块化处理,则可以将这些内容放在 <code>public</code> 文件夹,构建后会直接复制到 <code>dist</code> 目录,所以你需要通过<code>BASE_URL</code>来引入它们。</p><h3 id="在html模板中使用" tabindex="-1"><a class="header-anchor" href="#在html模板中使用" aria-hidden="true">#</a> 在HTML模板中使用</h3><p>在 <code>public/index.html</code> 中需要设置:</p><div class="language-html ext-html line-numbers-mode"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>link</span> <span class="token attr-name">rel</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>icon<span class="token punctuation">"</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span><%= BASE_URL %>favicon.ico<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><h3 id="在-vue-和-js-文件中使用" tabindex="-1"><a class="header-anchor" href="#在-vue-和-js-文件中使用" aria-hidden="true">#</a> 在.vue 和 js 文件中使用</h3><div class="language-vue ext-vue line-numbers-mode"><pre class="language-vue"><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>template</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">:src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>`${publicPath}my-image.png`<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>template</span><span class="token punctuation">></span></span>\n<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span><span class="token punctuation">></span></span><span class="token script"><span class="token language-javascript">\n<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>\n <span class="token function">setup</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword">return</span> <span class="token punctuation">{</span>\n <span class="token literal-property property">publicPath</span><span class="token operator">:</span> process<span class="token punctuation">.</span>env<span class="token punctuation">.</span><span class="token constant">BASE_URL</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n</span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>\n</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div>',7),e={},p=(0,s(3744).Z)(e,[["render",function(n,a){return t}]])},3744:(n,a)=>{a.Z=(n,a)=>{const s=n.__vccOpts||n;for(const[n,t]of a)s[n]=t;return s}}}]); |