browse.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class='browse'>
  3. <div>
  4. <img src="@/assets/img/logo.png" alt="">
  5. <span class="line"></span>
  6. <img src="@/assets/img/eye.png" alt="">
  7. <span class="txt">{{myMoods}}访问量</span>
  8. </div>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name:'browse',
  14. components: {},
  15. data() {
  16. //这里存放数据
  17. return {
  18. myMoods:0
  19. };
  20. },
  21. //监听属性 类似于data概念
  22. computed: {},
  23. //监控data中的数据变化
  24. watch: {},
  25. //方法集合
  26. methods: {
  27. },
  28. //生命周期 - 创建完成(可以访问当前this实例)
  29. created() {
  30. },
  31. //生命周期 - 挂载完成(可以访问DOM元素)
  32. mounted() {
  33. fetch("http://47.112.166.173:8109/api/count/saveVisit/" + window.number)
  34. .then((response) => response.json())
  35. .then((data) => {
  36. this.myMoods = data.data.visitSum;
  37. // console.log(data)
  38. });
  39. },
  40. beforeCreate() {}, //生命周期 - 创建之前
  41. beforeMount() {}, //生命周期 - 挂载之前
  42. beforeUpdate() {}, //生命周期 - 更新之前
  43. updated() {}, //生命周期 - 更新之后
  44. beforeDestroy() {}, //生命周期 - 销毁之前
  45. destroyed() {}, //生命周期 - 销毁完成
  46. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  47. }
  48. </script>
  49. <style lang='less' scoped>
  50. .browse{
  51. position: fixed;
  52. top: 30px;
  53. left: 40px;
  54. z-index: 999;
  55. &>div{
  56. display: flex;
  57. align-items: center;
  58. }
  59. .line{
  60. margin: 0 15px;
  61. display: inline-block;
  62. width: 2px;
  63. height: 30px;
  64. background-image: linear-gradient(rgba(255,255,255,.3), rgba(255,255,255));
  65. }
  66. .txt{
  67. color: #fff;
  68. margin-left: 10px;
  69. }
  70. }
  71. </style>