1
0

journey.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="app-page">
  3. <view class="page-title">我们的故事</view>
  4. <view class="html-typed" v-html="html">内容渲染</view>
  5. <scroll-btn bottom="160rpx" :scrollTop.sync="scrollTop"></scroll-btn>
  6. </view>
  7. </template>
  8. <script>
  9. import LoveConfig from '@/config/love.config.js';
  10. import ScrollBtn from '@/components/scroll-btn/scroll-btn.vue';
  11. export default {
  12. components: { ScrollBtn },
  13. data() {
  14. return {
  15. scrollTop: 0,
  16. html: '',
  17. timer: null
  18. };
  19. },
  20. created() {
  21. this.fnInit();
  22. },
  23. onPageScroll(e) {
  24. this.scrollTop = e.scrollTop;
  25. },
  26. onBackPress() {
  27. clearTimeout(this.timer);
  28. },
  29. methods: {
  30. fnInit() {
  31. clearTimeout(this.timer);
  32. const _html = LoveConfig.journey;
  33. let _index = 0;
  34. const _typing = () => {
  35. this.timer = setTimeout(() => {
  36. if (_index >= _html.length) {
  37. clearTimeout(this.timer);
  38. } else {
  39. this.html += _html.substring(_index, _index + 1);
  40. _index += 1;
  41. _typing();
  42. }
  43. }, 100);
  44. };
  45. _typing();
  46. }
  47. }
  48. };
  49. </script>
  50. <style scoped lang="scss">
  51. .app-page {
  52. width: 100vw;
  53. min-height: 100vh;
  54. box-sizing: border-box;
  55. padding: 36rpx;
  56. /* #ifdef APP-PLUS */
  57. padding-top: 100rpx;
  58. /* #endif */
  59. /* #ifdef H5 */
  60. padding-top: 80rpx;
  61. /* #endif */
  62. /* #ifdef MP-WEIXIN */
  63. padding-top: 120rpx;
  64. /* #endif */
  65. background: linear-gradient(
  66. -45deg,
  67. rgba(247, 149, 51, 0.1),
  68. rgba(243, 112, 85, 0.1) 15%,
  69. rgba(239, 78, 123, 0.1) 30%,
  70. rgba(161, 102, 171, 0.1) 44%,
  71. rgba(80, 115, 184, 0.1) 58%,
  72. rgba(16, 152, 173, 0.1) 72%,
  73. rgba(7, 179, 155, 0.1) 86%,
  74. rgba(109, 186, 130, 0.1)
  75. );
  76. color: rgba(26, 26, 26, 1);
  77. }
  78. .page-title {
  79. font-size: 42rpx;
  80. font-weight: bold;
  81. text-align: center;
  82. text-shadow: 0rpx 4rpx 24rpx #bfe9ef;
  83. }
  84. .html-typed {
  85. margin-top: 52rpx;
  86. line-height: 1.8;
  87. font-size: 30rpx;
  88. }
  89. </style>