arthur-e / Wicket

A modest library for moving between Well-Known Text (WKT) and various framework geometries
https://arthur-e.github.io/Wicket/
Other
586 stars 226 forks source link

Cannot read property 'polygon' of undefined #150

Closed pjs21s closed 4 years ago

pjs21s commented 4 years ago

Hello I'm using Wicket like this (vue : 2.6.11, leaflet : 1.6.0, wicket : 1.3.6)

<template>
<l-control>
      <p @click="makePolygon"></p>
      </l-control>
</template>
<script>
import Wkt from 'wicket';

makePolygon() {
      let wkt = new Wkt.Wkt();
      let poly = wkt.read("POLYGON ((126.93191528320311 37.48248679787437, 127.09671020507812 37.48248679787437, 127.09671020507812 37.607704112428394, 126.93191528320311 37.607704112428394, 126.93191528320311 37.48248679787437))").toObject();
console.log(poly);

</script>
}

When i click my makePolygon event then i can see these error

[Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'polygon' of undefined"
TypeError: Cannot read property 'polygon' of undefined

I wrote wrong code or is this bug? Even i deleted npm module and only used wicket with cdn but i saw same errors Thank you for reading

arthur-e commented 4 years ago

Hi @pjs21s, it definitely looks like the wrong code in the example you provided. Your closing curly brace } is outside of the closing </script> tag when it should be inside.

pjs21s commented 4 years ago

@arthur-e that was my mistake. Even i write tag right way. There is same error.