静态页面使用elementui
时间: 2023-11-10 08:03:21 浏览: 189
生鲜水果商品商城静态网站,vue+elementui简单实现
5星 · 资源好评率100%
可以使用 ElementUI 来构建静态页面。首先需要在 HTML 文件中引入 ElementUI 的 CSS 和 JS 文件,然后按照 ElementUI 的组件文档来使用组件即可。
例如,可以使用以下代码来创建一个包含表格和分页的页面:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Static Page with ElementUI</title>
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="app">
<el-table :data="tableData">
<el-table-column prop="name" label="Name"></el-table-column>
<el-table-column prop="age" label="Age"></el-table-column>
<el-table-column prop="address" label="Address"></el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="1000">
</el-pagination>
</div>
<script>
new Vue({
el: '#app',
data: {
tableData: [
{ name: 'John', age: 18, address: 'New York' },
{ name: 'Jane', age: 22, address: 'London' },
{ name: 'Bob', age: 30, address: 'Paris' },
{ name: 'Alice', age: 25, address: 'Tokyo' }
],
currentPage: 1,
pageSize: 10
},
methods: {
handleSizeChange: function(newSize) {
this.pageSize = newSize;
},
handleCurrentChange: function(newPage) {
this.currentPage = newPage;
}
}
});
</script>
</body>
</html>
```
阅读全文