# 使用

下面是一个简单的完整例子:

目录结构

test
  |- app.vue
  |- index.html
  |- index.js
1
2
3
4

index.html

<!DOCTYPE html>
<html lang="zh-Hans">
  <head>
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, user-scalable=no"
    />
    <title>Slug UI</title>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14

index.js

import Vue from 'vue'
import SlugUI from '@tencent/slug-ui'

Vue.use(SlugUI)

window.vm = new Vue({
  el: '#root',
  render: h => h(App),
})
1
2
3
4
5
6
7
8
9

app.vue

<template>
  <sui-icon name="search" class="slug-ui"></sui-icon>
</template>

<script>
  export default {
    name: 'demo',
  }
</script>

<style lang="postcss">
  .slug-ui {
    width: 42px;
    height: 42px;
    margin: 6px;
  }
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17