久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      uni-app如何引用npm第三方庫

      uni-app引用npm第三方庫的方法:首先下載第三方庫;然后創(chuàng)建【uni-app】工程;最后在【uni-app】里面使用第三方庫,代碼為【import * as echarts from 'echarts'】。

      uni-app如何引用npm第三方庫

      本教程操作環(huán)境:windows7系統(tǒng)、uni-app2.5.1版本,該方法適用于所有品牌電腦。

      推薦(免費(fèi)):uni-app開發(fā)教程

      uni-app引用npm第三方庫的方法:

      1. 下載第三方庫

      uni-app 使用了 mpvue 的部分代碼,所以我們的 echarts 庫使用兼用 mpvue 版本的 mpvue-echarts,同時(shí)需要引用百度的 echarts。

      下載流程如下:

      • 創(chuàng)建一個(gè)空的文件夾如:test-echarts。

      • 進(jìn)入 test-echarts 打開命令行工具,執(zhí)行 npm init 一路回車即可。

      • 下載第三方庫:npm install echarts mpvue-echarts –save。

      • 進(jìn)入 node_modules 目錄,里面的三個(gè)目錄:echarts、mpvue-echatszrender就是我們需要的第三方庫。

      2. 創(chuàng)建uni-app工程

      在 HBuilderX 里面新建 uni-app,將將剛才下載的三個(gè)文件夾拷貝到項(xiàng)目根目錄,最終項(xiàng)目截圖如下:

      uni-app如何引用npm第三方庫

      3. 在uni-app里面使用第三方庫

      和一般的 vue 項(xiàng)目引用第三方庫的方法一樣,如下所示,這樣我們就能在工程里面使用 echarts 和 mpvue-echarts 了。

      import * as echarts from 'echarts'   import mpvueEcharts from 'mpvue-echarts'

      本示例源碼在附件工程里面,下面是部分代碼和效果截圖:

      <template>       <div class="container">           <mpvue-echarts :echarts="echarts" :onInit="onInit" />       </div>   </template>   <script>       import * as echarts from 'echarts'       import mpvueEcharts from 'mpvue-echarts'       function initChart(canvas, width, height) {           ......       }       export default {           data() {               return {                   echarts,                   onInit: initChart               }           },           components: {               mpvueEcharts           }       }   </script>   <style>       .container {           flex: 1;       }   </style>

      uni-app如何引用npm第三方庫

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)