Giter Site home page Giter Site logo

Translate buttons action about vue-tour HOT 6 CLOSED

pulsardev avatar pulsardev commented on August 16, 2024
Translate buttons action

from vue-tour.

Comments (6)

Outpox avatar Outpox commented on August 16, 2024

Hi,

You can already do this by customizing the steps. Take a look at the example in our doc.
If you're still having trouble after that do not hesitate to re-open the issue.

from vue-tour.

joffreyBerrier avatar joffreyBerrier commented on August 16, 2024

Hi,

when i put this, in my code :

<v-tour name="myTour" :steps="steps">
  <template slot-scope="tour">
    <transition name="fade">
      <v-step
        v-if="tour.currentStep === index"
        v-for="(step, index) of tour.steps"
        :key="index"
        :step="step"
        :previous-step="tour.previousStep"
        :next-step="tour.nextStep"
        :stop="tour.stop"
        :isFirst="tour.isFirst"
        :isLast="tour.isLast"
      >
        <template v-if="tour.currentStep === 2">
          <div slot="actions">
            <button @click="tour.previousStep" class="btn btn-primary">Previous step</button>
            <button @click="tour.nextStep" class="btn btn-primary">Next step</button>
          </div>
        </template>
      </v-step>
    </transition>
  </template>
</v-tour>

i have many errors, like : Property or method "tour" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

if i want to change just the wording i don't understand why i should change all the component, it's possible to make variables like for content.

It's possible to explain how i can change the wording ?

thx

from vue-tour.

Outpox avatar Outpox commented on August 16, 2024

We thought of integrating i18n but we had no time yet.
We also didn't want to add a setting in the tour configuration as we don't see this as a configuration.

If you've already added the tour to your app (by following the README), you may just have the default import:

<template>
  <div>
    <div id="v-step-0">A DOM element on your page. The first step will pop on this element because its ID is 'v-step-0'.</div>
    <div class="v-step-1">A DOM element on your page. The second step will pop on this element because its ID is 'v-step-1'.</div>
    <div data-v-step="2">A DOM element on your page. The third and final step will pop on this element because its ID is 'v-step-2'.</div>

    <v-tour name="myTour" :steps="steps"></v-tour>
  </div>
</template>

To change all the steps buttons content you need to re-define their template and add you own values.
I believe you want to translate it to French so it would be as follow:

<v-tour name="myTour" :steps="steps">
  <template slot-scope="tour">
    <transition name="fade">
      <v-step
        v-if="tour.currentStep === index"
        v-for="(step, index) of tour.steps"
        :key="index"
        :step="step"
        :previous-step="tour.previousStep"
        :next-step="tour.nextStep"
        :stop="tour.stop"
        :isFirst="tour.isFirst"
        :isLast="tour.isLast"
      >
        <template>
          <div class="v-step__buttons">
            <button @click="stop" v-if="!isLast" class="v-step__button">Passer le tour</button>
            <button @click="previousStep" v-if="!isFirst" class="v-step__button">Précédent</button>
            <button @click="nextStep" v-if="!isLast" class="v-step__button">Suivant</button>
            <button @click="stop" v-if="isLast" class="v-step__button">Terminer</button>
          </div>
        </template>
      </v-step>
    </transition>
  </template>
</v-tour>

I've just copied and re-declared the VStep source and translated the button content. Let me know if that's good for you.

from vue-tour.

joffreyBerrier avatar joffreyBerrier commented on August 16, 2024

i called vue tour like this :

on my html file :

<div class="v-tour-0"></div>
<v-tour name=".." :steps="steps"></v-tour>

on my js file :

import VueTour from 'vue-tour'
Vue.use(VueTour)
data : {
steps: [
      {
        target: '.v-step-0',
        content: `...`,          
        params: {
          placement: 'top'
        }
      },
]
}

It's works perfectly i just want to change the language of buttons but when i put your code by replacing the line :

<v-tour name="product_index" :steps="steps"></v-tour>

i have this error :

[Vue warn]: Property or method "tour" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
[Vue warn]: Error in render function: "TypeError: Cannot read property 'steps' of undefined"
TypeError: Cannot read property 'steps' of undefined
[Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'start' of undefined"
TypeError: Cannot read property 'start' of undefined

i don't understand how i change simply the template ...

from vue-tour.

Outpox avatar Outpox commented on August 16, 2024

Right now I can't help you, the JS you provided isn't valid.
Please take a look at the provided demo code in the repo and especially this part : https://github.com/pulsardev/vue-tour/blob/master/demo/src/components/MyTour.vue
In our example the idea is that a tour is created in a custom component and is being redefined. Then the component is re-used as you would normally do in Vue wherever it's needed.

from vue-tour.

AlyssonSouza avatar AlyssonSouza commented on August 16, 2024

Hi guys,

You can set inside options variable:

<v-tour name="myTour" :steps="steps" :options="options"></v-tour>

options: {
labels:{
buttonSkip: "Pular",
buttonPrevious: "Anterior",
buttonNext: "Próximo",
buttonStop: "Parar"
}
}

from vue-tour.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.