2

If I define a property for a component MyComp1 like that

props: {
  display: {
    type: [Boolean, Array],
    validator: function (value) {
      return value === false && value !== true;
    },
    default: false,
  },
},

How can I use it in my component MyComp2? I tried different syntax's

<MyComp1 display=[mobile, tablet]><MyComp1>
<MyComp1 display="['mobile', 'tablet']"><MyComp1>
<MyComp1 display="mobile,tablet"><MyComp1>

but none works. Which is the right syntax?

2

1 Answer 1

2

You are missing the colon before 'display'

<MyComp1 :display="['mobile', 'tablet']"><MyComp1>

instead of

<MyComp1 display="['mobile', 'tablet']"><MyComp1>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.