Orlandster / vue-typed-js

Typed.js integration for vue.js. Create a typing animation.
http://www.mattboldt.com/demos/typed-js/
MIT License
469 stars 37 forks source link

Question: How to use programmatically in Nuxt? #19

Open cliqer opened 5 years ago

cliqer commented 5 years ago

Works perfectly in template as a component but need to use it as variable within another component. Tried it as a constructor in mounted and computed but still no luck. Can you please help me? https://codesandbox.io/s/ckybh?fontsize=14 Many Thanks

reflexator commented 4 years ago

Dont use it as component

https://codesandbox.io/s/vue-typed-js-e8uil

<template>
<div>
  <h2 ref="useTypedHere"></h2>

   <button @click="clickToUseTyped()">Click to type</button>
</div>
</template>
<script>
import Typed from 'typed.js'
export default {
  methods: {
    clickToUseTyped() {
        new Typed(this.$refs.useTypedHere, {
          strings: ['Some text or variable here']
        })
     }
  }
}
</script>
cliqer commented 4 years ago

@reflexator thank you for this; it actually works using refs but it doesn't in my example.

I am trying to use typed as iView's -> Select -> :placeholder without luck.

It must have to do of how the custom Select component works within iView but I can't understand what the problem is and how to fix.

Many thanks for your help.