Vue: How do you expand properties for dom in vue-template? To achieve the effect of dynamic delivery attributes. (... object)

Created on 30 Mar 2017  ·  3Comments  ·  Source: vuejs/vue

What problem does this feature solve?

For example, when I use react, the dynamic attributes of the operation of dom:

// The "options" is a object.
<div {... options} />

So I realized the production of the object through the front of the object to achieve the dynamic operation of the div, because I can not determine the property has a fixed set, can only use the program production, react also take this into account so that they describe the render also directly , The direct use of ES6 attribute expansion (... operator) can achieve results.

However, in the vue-template, try the ES6 deconstruction (... operator) also read the entire vue official documents, are to find relevant instructions and documentation.

What does the proposed API look like?

Just as react as simple as providing a parameter argument, setting a dynamic property, or providing something like react, directly supporting the use of ES6's ... object structure.

Most helpful comment

v-bind="object"

All 3 comments

中文描述版本

What problem does this feature solve?

举个例子,我在使用 react 的时候,对 dom 进行动态属性的操作:

// The 「options」 is a object.
<div {...options} />

这样我就实现了 通过前面生产 options 这个对象达到对 div 的动态属性操作,因为我无法确定拥有固定的属性设置,只能运用程序生产,react 也考虑到了这一点 所以 react 他们描述 render 中也直接说,直接运用 ES6 的属性展开(... 操作符)就可以达到效果。

但是在 vue-template 中,尝试了 ES6 的解构符(... 操作符)也完整的翻阅了整个 vue 官方文档,均为找到相关说明和文档。

What does the proposed API look like?

就像 react 那么简单,提供一个参数参数,设置动态属性,或者提供 类似 react 那种,直接支持使用 ES6 的 ... object 结构符。

v-bind="object"

@yyx990803 Thanks, It is recommended to join vue official documents, thanks again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulpflug picture paulpflug  ·  3Comments

guan6 picture guan6  ·  3Comments

franciscolourenco picture franciscolourenco  ·  3Comments

lmnsg picture lmnsg  ·  3Comments

aviggngyv picture aviggngyv  ·  3Comments