Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for using snap-svg in Vue #654

Open
ap1969 opened this issue Jul 22, 2021 · 2 comments
Open

Solution for using snap-svg in Vue #654

ap1969 opened this issue Jul 22, 2021 · 2 comments

Comments

@ap1969
Copy link

ap1969 commented Jul 22, 2021

Hi all,

I've been reading about all the webpack-related issues, eve being undefined, and so on, and decided to put together a solution for using Snap.svg in Vue 3.

The solution is pretty straightforward, so should be relatively easy to map across to React, and it may even work in Vue 2 as-is.

Hope it helps.

Here's the gist.

Regards,
Andy

@Alex-Golovin
Copy link

https://www.npmjs.com/package/snapsvg-cjs-ts

@ralexrdz
Copy link

Used like this

<template>
  <svg id="svg"></svg>
</template>

<script>
import * as Snap from 'snapsvg-cjs'

export default {
  mounted() {
    this.drawChart();
  },
  methods: {
    drawChart() {
      
       var s = Snap('#tree');
       s.rect(0,0, 100, 100);
     
    },
  },
};
</script>

<style>
#svg {
  width: 100%;
  height: 100%;
}
</style>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants