Fix maps break when no prop is available
This commit is contained in:
30
.eslintrc.js
Normal file
30
.eslintrc.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
env: {
|
||||||
|
node: true
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
"plugin:vue/vue3-essential",
|
||||||
|
"eslint:recommended",
|
||||||
|
"@vue/prettier",
|
||||||
|
"plugin:cypress/recommended"
|
||||||
|
],
|
||||||
|
parserOptions: {
|
||||||
|
parser: "babel-eslint"
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
||||||
|
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
"**/__tests__/*.{j,t}s?(x)",
|
||||||
|
"**/tests/unit/**/*.spec.{j,t}s?(x)"
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
jest: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {inject, ref} from "vue";
|
import {inject, ref, computed} from "vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -27,7 +27,9 @@ export default {
|
|||||||
"mapPromise"
|
"mapPromise"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mapPromise) {
|
const hasLocation = computed(()=> props?.location?.lat && props?.location?.lng);
|
||||||
|
|
||||||
|
if (mapPromise && hasLocation.value) {
|
||||||
mapPromise.then((googleMap) => {
|
mapPromise.then((googleMap) => {
|
||||||
const infoWindow = new google.maps.InfoWindow();
|
const infoWindow = new google.maps.InfoWindow();
|
||||||
const options = {
|
const options = {
|
||||||
|
|||||||
2
package.json
Executable file → Normal file
2
package.json
Executable file → Normal file
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@fawmi/vue-google-maps",
|
"name": "@fawmi/vue-google-maps",
|
||||||
"description": "Google Map components for Vue.js 3",
|
"description": "Google Map components for Vue.js 3",
|
||||||
"version": "0.2.3",
|
"version": "0.2.6",
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user