journey.vue 1.5 KB

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