hot.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  6. <title>热榜</title>
  7. <meta name="referrer" content="https://open.tophub.today/hot"/>
  8. <script src="js/vue.min.js"></script>
  9. <script src="js/axios.min.js"></script>
  10. <style>
  11. body {
  12. margin: 0;
  13. padding: 10px;
  14. font-family: Arial, sans-serif;
  15. }
  16. #app {
  17. max-width: 800px;
  18. margin: 0 auto;
  19. }
  20. ol {
  21. padding-left: 20px;
  22. }
  23. li {
  24. margin: 10px 0;
  25. line-height: 1.5;
  26. }
  27. a {
  28. color: #333;
  29. text-decoration: none;
  30. word-break: break-word;
  31. }
  32. a:hover {
  33. color: #007bff;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <div id="app">
  39. <p style="font-size: 18px; font-weight: bold; margin-bottom: 15px;">热榜</p>
  40. <ol>
  41. <li v-for="(v,i) in hotList">
  42. <a target="_blank" :href="v.url">{{v.sitename}}:{{v.title}}</a>
  43. </li>
  44. </ol>
  45. </div>
  46. <script>
  47. let url = "https://web_history.tianyunperfect.cn/api3/hot";
  48. new Vue({
  49. el: "#app",
  50. data: {
  51. hotList: []
  52. }, methods: {
  53. getHotList: function () {
  54. axios.get(url).then(res1 => {
  55. let res = res1.data;
  56. if (res.status == 200) {
  57. this.hotList = res.data.items;
  58. }
  59. });
  60. },
  61. },
  62. mounted: function () {
  63. this.getHotList();
  64. },
  65. });
  66. </script>
  67. </body>
  68. </html>