html配合cdn引入使用avue UI库

884 阅读1分钟

注意事项:

引入avue库时,同时也要引入Element库,所以在引入css样式、js文件都要同时引入avue和Element库

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>avue-UI</title>
  <!-- 引入样式文件 -->
  <!-- avue -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@smallwei/avue/lib/index.css" />
  <!-- element -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>

<body>

  <div id="app">
    <el-dialog title="提示" v-dialogdrag :visible.sync="box" :class="{'avue-dialog':type==0}" width="40%">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="box=false">取 消</el-button>
        <el-button type="primary" @click="box=false">确 定</el-button>
      </span>
    </el-dialog>
    <el-button @click="openBox(1)">原生el样式弹窗</el-button>
    <el-button type="primary" @click="openBox(0)">avue样式弹窗</el-button>
  </div>

</body>
  <!-- import Vue before Element -->
  <script src="https://unpkg.com/vue/dist/vue.js"></script>
  <!-- import Element and avue -->
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@smallwei/avue/lib/avue.min.js"></script>
<script>
  new Vue({
    el: '#app',
    data: function() {
      return {
        type: '',
        box: false
      }
    },
    methods: {
      openBox (type) {
        this.type = type
        this.box = true
      }
    }
  })
</script>
</html>