vue-elementui--按钮和提示信息的简单使用
<template><div class="hello"><el-alert v-if="show"title="点击提示成功的信息"description="这个框不用管他会自动消失的"show-iconcentertype="success"></el-alert><el-row>
·
<template>
<div class="hello">
<el-alert v-if="show"
title="点击提示成功的信息"
description="这个框不用管他会自动消失的"
show-icon
center
type="success">
</el-alert>
<el-row>
<el-button>默认按钮</el-button>
<el-button type="primary" @click="changeShow">点击提示成功</el-button>
<el-button type="success">成功按钮</el-button>
<el-button type="info">信息按钮</el-button>
<el-button type="warning">警告按钮</el-button>
<el-button type="danger">危险按钮</el-button>
</el-row>
<template>
<el-button :plain="true" @click="open2">成功</el-button>
<el-button :plain="true" @click="open3">警告</el-button>
<el-button :plain="true" @click="open1">消息</el-button>
<el-button :plain="true" @click="open4">错误</el-button>
</template>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Welcome to Your Vue.js App',
show:0
}
},
methods:{
changeShow:function(){
this.show = 1
setTimeout( this.changeHide, 2000)
},
changeHide:function ( ) {
this.show = 0
},
open1() {
this.$message('这是一条消息提示');
},
open2() {
this.$message({
message: '恭喜你,这是一条成功消息',
type: 'success'
});
},
open3() {
this.$message({
message: '警告哦,这是一条警告消息',
type: 'warning'
});
},
open4() {
this.$message.error('错了哦,这是一条错误消息');
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
更多推荐
已为社区贡献6条内容
所有评论(0)