Vue简单使用及整合elementui
<template>
<div id="app">
<el-button @click="handleClick">点击我</el-button>
</div>
</template>
<script>
export default {
name: 'App',
methods: {
handleClick() {
alert('按钮被点击');
}
}
}
</script>
<style>
#app {
text-align: center;
}
</style>
在这个简单的例子中,我们使用了Element UI的el-button
组件,并通过@click
事件监听器绑定了一个方法handleClick
,当按钮被点击时,会弹出一个警告框。这展示了如何在Vue项目中使用Element UI并进行简单的交互。
评论已关闭