简体   繁体   中英

TYPO3 Fluid: escape array key

I would like to escape the array key in TYPO3 Fluid template:

This works:

additionalAttributes="{v-model: 'title'}"

But this does not

additionalAttributes="{v-model.number: 'counter'}"
additionalAttributes="{'v-model.number': 'counter'}"

I need something to escape the dot in v-model . number ?

Exception message:

The argument "additionalAttributes" was registered with type "array", but is of type "string" in view helper "TYPO3\CMS\Fluid\ViewHelpers\Form\TextfieldViewHelper" (More information)

The expected result is:

<input v-model.number="counter" 

Which TYPO3-version are you using?

According to your code and expected result, I tested the following and this worked:

<f:form.submit
  name="pmAction"
  value="Next category"
  style="display: none;"
  id="dialogSubmit"
  additionalAttributes="{'v-model.number': 'counter'}"
/>

gave me

<input v-model.number="counter" id="dialogSubmit" style="display: none;" type="submit" value="Next category" name="tx_template_data[pmAction]">

in TYPO3 9.5.11

you can try its.

<input type="text" v-model="number"/>
    <Footer v-bind:additionalAttributes="{[number]: 'counter'}"/>

data(){
  return {
     number: 12
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM