question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Layout must be an array!

See original GitHub issue

I’m getting the error Error: Layout must be an array! when I try to incorporate the library into my application. I added the code here:

`<script>
  import SystemInformation from './LandingPage/SystemInformation'

  import VueGridLayout from 'vue-grid-layout'; 

  var GridLayout = VueGridLayout.GridLayout; 
  var GridItem = VueGridLayout.GridItem; 

  var testLayout = [
    {"x":0,"y":0,"w":2,"h":2,"i":"0"},
    {"x":2,"y":0,"w":2,"h":4,"i":"1"},
    {"x":4,"y":0,"w":2,"h":5,"i":"2"},
    {"x":6,"y":0,"w":2,"h":3,"i":"3"},
    {"x":8,"y":0,"w":2,"h":3,"i":"4"},
    {"x":10,"y":0,"w":2,"h":3,"i":"5"},
    {"x":0,"y":5,"w":2,"h":5,"i":"6"},
    {"x":2,"y":5,"w":2,"h":5,"i":"7"},
    {"x":4,"y":5,"w":2,"h":5,"i":"8"},
    {"x":6,"y":4,"w":2,"h":4,"i":"9"},
    {"x":8,"y":4,"w":2,"h":4,"i":"10"},
    {"x":10,"y":4,"w":2,"h":4,"i":"11"},
    {"x":0,"y":10,"w":2,"h":5,"i":"12"},
    {"x":2,"y":10,"w":2,"h":5,"i":"13"},
    {"x":4,"y":8,"w":2,"h":4,"i":"14"},
    {"x":6,"y":8,"w":2,"h":4,"i":"15"},
    {"x":8,"y":10,"w":2,"h":5,"i":"16"},
    {"x":10,"y":4,"w":2,"h":2,"i":"17"},
    {"x":0,"y":9,"w":2,"h":3,"i":"18"},
    {"x":2,"y":6,"w":2,"h":2,"i":"19"}
];



  export default {
  name: 'landing-page',
  data: {
    layout: testLayout
  }, 
  components: { SystemInformation, GridItem, GridLayout  },

methods: {
  open (link) {
    this.$electron.shell.openExternal(link)
  }
},
}
</script>`

Why is it giving out 😕?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
SmiffyKMccommented, Oct 20, 2017

Hey gmsa, I found out what the issue was. My data function was returning wrong. I needed to do this…

data () {
    return {
        layout: testLayout
    }
}

Thanks very much though for your fast response!

0reactions
ikbelkirasancommented, Mar 26, 2018

@TomFranssen When you create a new regular Vue instance using new Vue(...) then the data property needs to be an object. Otherwise, when the Vue instance is a Vue Component, then data should be a function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-grid-layout - Failed prop type: Layout property must be ...
I have followed the guide at react-grid-layout and I am still getting this error message.
Read more >
Argument 1 passed to Drupal\Core\Layout\LayoutDefault ...
TypeError: Argument 1 passed to Drupal\Core\Layout\LayoutDefault::build() must be of the type array, null given, called in /var/www/myProject/ ...
Read more >
Warning: count(): Parameter must be an array or an object…
Error message: Warning: count(): Parameter must be an array or an object… I am using wordpress 5.5. 1, so that probably means the...
Read more >
The contents field on a column layout may only contain ...
I've go the following pinkbox message when trying to access to a related action. Expression evaluation error in rule '*InsertRuleNameHere*' at function a!...
Read more >
Arrays (C++) | Microsoft Learn
Learn how to declare and use the native array type in the standard C++ programming language.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found