Reputation: 385
I'm new to vue3.
I installed the Vue Grid Layout package, and then created a component exactly as their example.
im getting: "Failed to resolve import "vue-grid-layout" from "src\components\Dashboard.vue". Does the file exist?"
Should i register it in main.js by app.use? is it mendatory?
<template>
<grid-layout :layout.sync="layout"
:col-num="12"
:row-height="30"
:is-draggable="draggable"
:is-resizable="resizable"
:vertical-compact="true"
:use-css-transforms="true"
>
<grid-item v-for="item in layout"
:static="item.static"
:x="item.x"
:y="item.y"
:w="item.w"
:h="item.h"
:i="item.i"
>
<span class="text">{{itemTitle(item)}}</span>
</grid-item>
</grid-layout>
</template>
<script>
import { GridLayout, GridItem } from "vue-grid-layout"
export default {
components: {
GridLayout,
GridItem
},
data() {
return {
layout: [
{"x":0,"y":0,"w":2,"h":2,"i":"0", static: false},
{"x":2,"y":0,"w":2,"h":4,"i":"1", static: true},
{"x":4,"y":0,"w":2,"h":5,"i":"2", static: false}
],
draggable: true,
resizable: true,
index: 0
}
},
methods: {
itemTitle(item) {
let result = item.i;
if (item.static) {
result += " - Static";
}
return result;
}
}
}
</script>
<style scoped>
.vue-grid-layout {
background: #eee;
}
.vue-grid-item:not(.vue-grid-placeholder) {
background: #ccc;
border: 1px solid black;
}
...etc...etc...
</style>```
Upvotes: 0
Views: 1682
Reputation: 385
This one is working as expected: https://grid-layout-plus.netlify.app/
Upvotes: 1