Skip to content

快速上手

这篇文档将指引如何快手上手使用组件库。

Vue 版本

建议使用 Vue.js >= 3.3.2

安装

YARN

sh
yarn add earthsdk-ui --save

NPM

sh
npm i earthsdk-ui --save

CDN

unpkg

html
<link rel="stylesheet" href="//unpkg.com/earthsdk-ui/lib/style.css"/>
<script src="//unpkg.com/earthsdk-ui"></script>

jsdelivr

html
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/earthsdk-ui/lib/style.css"/>
<script src="//cdn.jsdelivr.net/npm/earthsdk-ui"></script>

使用

全局引入

main.js/main.ts

js
import { createApp } from 'vue';
import App from './App.vue';
import 'earthsdk-ui/lib/style.css';
import EarthSDKUI from 'earthsdk-ui';
const app = createApp(App);
app.use(EarthSDKUI);
app.mount('#app');

页面内使用

vue
<es-button>按钮</es-button>

按需引入

页面内使用

vue
<script setup>
    import { ESButton } from 'earthsdk-ui';
</script>
<template>
    <ESButton>按钮</ESButton>
</template>
<style scoped>
</style>