rss-reader/index.html

119 lines
3.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RSS Reader</title>
<!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> -->
<link rel="stylesheet" href="static/index.css">
<link rel="icon" href="static/favicon.svg" type="image/x-icon">
<style>
body {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 30px;
}
.card-header {
display: flex;
justify-content: center;
align-items: center;
font-size: 18px;
font-weight: bold;
}
.list-item {
display: flex;
align-items: center;
text-align: left;
width: 100%;
}
.list-item-title {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-grow: 1;
text-align: left;
width: 100%;
margin-bottom: 10px;
}
.title-link {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
}
a {
color: black;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.feed-col {
margin-bottom: 20px;
}
</style>
</head>
<body>
<div id="app">
<el-container>
<el-header>
<h1>RSS Reader</h1>
</el-header>
<el-main>
<el-row :gutter="20">
<el-col :xs="24" :sm="12" :md="8" :lg="6" v-for="(feed, index) in feeds" :key="index" class="feed-col">
<el-card class="box-card">
<div slot="header" class="card-header">
<span>{{ feed.title }}</span>
</div>
<el-scrollbar style="height: 300px;">
<el-list v-for="(item, i) in feed.items" :key="i">
<el-list-item>
<el-link class="list-item-title" :href="item.link" target="_blank" :title="item.title">{{ item.title }}</el-link>
</el-list-item>
</el-list>
</el-scrollbar>
</el-card>
</el-col>
</el-row>
</el-main>
</el-container>
</div>
<!-- <script src="https://unpkg.com/vue@next"></script> -->
<script src="static/vue.global.js"></script>
<!-- <script src="https://cdn.bootcdn.net/ajax/libs/element-plus/2.3.3/index.full.js"></script> -->
<script src="static/index.full.js"></script>
<script>
const app = Vue.createApp({
data() {
return {
feeds: [],
};
},
async created() {
const socket = new WebSocket("ws://localhost:8080/ws");
socket.onmessage = event => {
const feed = JSON.parse(event.data);
this.feeds.push(feed);
};
},
});
app.use(ElementPlus);
app.mount("#app");
</script>
</body>
</html>