本帖最后由 搬砖人 于 2021-7-6 12:06 编辑
Dynamic Arguments
- <component
- :[getConfigType()]="getConfigValue"
- :api="formData[scope.$index][cindex]['api']"
- :key="updatekey"
- :placeholder="formData[scope.$index][cindex].placeholder"
- :is="head.tag"
- :elData="head"
- :disabled="formData[scope.$index][cindex].formOperates == G.FORM_OPERATE.READ ? true : false"
- v-model="formData[scope.$index][cindex].value"
- v-bind="getConfById(head.formId)"
- @change="getCustomConfig({
- row:scope.$index,
- cIndex: cindex,
- tag: head.tag,
- type:G.CUSTOM_CONFIG.EVENT,
- eventFrom:G.EVENT_FROM.CHANGE
- })"
- >
-
-
- methods: {
- //用一个方法来生成属性值
- getConfigValue() {
- },
- //用一个方法来生成一个属性名
- getConfigType() {
- alert()
- return 'test'
- },
复制代码
New in 2.6.0+
Starting in version 2.6.0, it is also possible to use a JavaScript expression in a directive argument by wrapping it with square brackets:
<!--
Note that there are some constraints to the argument expression, as explained
in the "Dynamic Argument Expression Constraints" section below.
-->
<a v-bind:[attributeName]="url"> ... </a>
Similarly, you can use dynamic arguments to bind a handler to a dynamic event name:
<a v-on:[eventName]="doSomething"> ... </a>
<a v-bind:['foo' + bar]="value"> ... </a>
<form v-on:submit.prevent="onSubmit"> ... </form>
参考:
https://vuejs.org/v2/guide/syntax.html
如果是传入多个动态属性
参考:
https://stackoverflow.com/questi ... l-parameters-in-vue
let data = {
param1: 'val1',
param2: 'val2',
param3: 'val3'
}
<div v-bind="data"></div>
|