Properties 如何使用条件操作将属性过度指定给vue组件或用户默认值

Properties 如何使用条件操作将属性过度指定给vue组件或用户默认值,properties,vue.js,conditional-operator,Properties,Vue.js,Conditional Operator,我尝试使用条件操作来确定是否必须将属性传递给vue组件,或者甚至使用组件属性的默认值 诸如此类: <my-example-component :example-property="myValue ? {test: 1, example: 'test'} : *use default*"> </my-example-component> 你看到我的麻烦了吗^^ 我知道这样做行不通,但你们中的一些人可能有办法解决我的问题 祝你今天愉快 马库斯;-) 我自己解决了这个问

我尝试使用条件操作来确定是否必须将属性传递给vue组件,或者甚至使用组件属性的默认值

诸如此类:

<my-example-component 
:example-property="myValue ? {test: 1, example: 'test'} : *use default*">
</my-example-component>

你看到我的麻烦了吗^^

我知道这样做行不通,但你们中的一些人可能有办法解决我的问题

祝你今天愉快


马库斯;-)

我自己解决了这个问题

<my-example-component 
:example-property="myValue ? {test: 1, example: 'test'} : NULL">
</my-example-component>

我只是提交空如果!myVlue和子组件使用其属性的默认值

亲切问候,

马库斯;-)