B
B
BonBon Slick2020-07-31 13:10:31
Apache Cordova
BonBon Slick, 2020-07-31 13:10:31

How to use plugins for cordova in vue templates?

A tax question in a dead off community.

Integrating cordova plugins for Vue and Nuxt?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BonBon Slick, 2020-08-02
@BonBonSlick

it took really a lot of time, 15-20 hours, few examples, the docks are bare, and the debug of the application is generally tin, made a build, fell off, sit and explain why.

spoiler

<template>
    <div>
        <h1 v-text="this.title"></h1>
        <hr>
        <h1 v-text="this.steps"></h1>
        <hr>
        <small>
            Above should be number
        </small>
    </div>
</template>

<script>
      import Vue                      from 'vue';
    import {mapActions, mapGetters} from 'vuex';
    import {SESSION}                from '../store/modulesNames';

    export default {
        layout:   'default',
        data:     () => (
            {
                title: 'Steps:',
                test: 0,
            }
        ),
        computed: {
            ...mapGetters(
                SESSION,
                {
                    steps: `getSteps`,
                }
            ),
        },
        methods:  {
            ...mapActions(
                SESSION,
                {
                    updateSteps: `updateSteps`,
                }
            ),

            error (err) {
                alert(`Something went wrong, please contact support`);
                alert(JSON.stringify(err));
            },
            startWatch () {

                const offset = 0;
                const options = {
                    pedometerIsCountingText:      'SGX counts your steps',
                    pedometerStepsToGoFormatText: '~%s steps to finish',
                    pedometerYourProgressFormatText: '~%s progress',
                    pedometerGoalReachedFormatText: '%s congrats finish!',
                };
                const goal = 1000;
                window.stepper.setGoal(goal, ()=>{}, this.error);
                window.stepper.startStepperUpdates(
                    offset,
                    this.updateStepsSuccess,
                    this.error,
                    options
                );
            },
            updateStepsSuccess (result) {
                const {steps_today, total, average} = result;
                // alert(JSON.stringify(result));
                this.updateSteps({steps: steps_today});
            },
        },
        mounted () {
            document.addEventListener('deviceready', () => {
                alert('Device ready event fired!');
                this.startWatch();
            });

        },
    }
</script>

<style lang="scss" scoped>

</style>

Icons and other fonts still fell off there.
I'll do it next time.
Plugin dock
An example that was taken as a basis

V
Vladimir Korotenko, 2020-07-31
@firedragon

Give an example of code, in any case, the addmob could be integrated normally

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question