vue-cli 引入 element u

vue配套ui框架 element ui(饿了么开源项目)

  • 进入项目先安装element ui
npm i element-ui -S
  • 也可以直接引入文件
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
  • 引入

    在你的main.js中引入ui库

import Vue from 'vue'
import ElementUI from 'element-ui'; //引入element ui
import 'element-ui/lib/theme-chalk/index.css';//样式需要单独引入
import App from './App'


Vue.use(ElementUI);

// 在你的模块中调用
//这里举例对话框的调用
methods: {
cancel: function (item) {
    var _that = this; //记录this
    this.$confirm('确认是否停止', '停止', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
      center: true
    }).then(() => { //确定回调
      //停止请求
      var param = item.id + '/cancel';
      this.$axios({
        url: this.api_url + 'stream/' + param,
        method: 'PUT'
      }).then(function () {//请求中的this需要在外边记录
        _that.$message({
          type: 'success',
          message: '停止成功!'
        });
      });
    }).catch(() => {  //取消回调
      _that.$message({
        type: 'cancel',
        message: '取消!'
      });
    })
  }
}

其他部分可以参考文档进行使用。
element ui

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Eighteen Z

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值