【问题标题】:How to make a Walkthrough Introduction Slider in Ionic Vue Application?如何在 Ionic Vue 应用程序中制作演练介绍滑块?
【发布时间】:2021-12-30 07:07:04
【问题描述】:

当我们第一次安装应用程序时,我看到大多数移动应用程序都有一个介绍滑块。 我在谷歌上搜索过,但它们都是带有 Angular 的旧版 Ionic。

我对将组件放在哪里以及如何管理状态感到非常困惑。

我在我的应用程序中使用电容器,我认为电容器具有存储功能。

我也想知道做这件事的正确流程是什么。

提前致谢。

【问题讨论】:

  • 使用 swiper.js。 swiperjs.com/vue
  • 看看这篇文章-dev.to/aaronksaunders/…如果您有任何问题,请发表评论
  • 我认为 swiper.js 应该是这种事情的一个不错的选择。接下来应该如何实现呢?

标签: javascript vue.js ionic-framework ionic-vue


【解决方案1】:

在您必须将某种信息存储到设备之前,记住或跟踪是否显示了滑块。您可以使用localStoragecapacitor storage 插件。我建议使用该插件,因为 localStorage 数据可能会在一段时间后被操作系统或用户删除。

这是使用插件实现此目的的过程。

安装并同步插件

如果您使用的是 Capacitor 版本 2 或更低版本,则不必安装它。

npm install @capacitor/storage
npx cap sync

这样使用

import { Storage } from '@capacitor/storage';

const { value } = Storage.get({
  key: 'introShowed',
});

if (!value) {
  // logic to show the intro goes here

  // set the value to true so next time this code block will not be executed
  Storage.set({
    key: 'introShowed',
    value: true,
  });
}

【讨论】:

  • 太棒了,太棒了
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-24
  • 2010-11-26
相关资源
最近更新 更多