[英]How can I add id by 1 for input field in each for loop?
My current html code is: 我当前的html代码是:
<div id="app">
<div class="row" v-for="(book, index) in seziure" :key="index">
<div class="col-md-8">
<div class="form-group label-floating">
<label class="control-label"> Details</label>
<input type="text" class="form-control" v-model="book.details" id="'transliterateTextarea'+(index+1)">
</div>
</div>
</div>
<a @click="addNewRow">Add Another</a>
</div>
But I think id is not changing. 但我认为id不会改变。
What is the error in that. 这是什么错误。 Actually I am looking for transliteration id's to be changed for each input fields. 实际上,我正在寻找每个输入字段要更改的音译ID。
I am able to change transliteration ids by the following code: 我可以通过以下代码更改音译ID:
<script type="text/javascript">
function transliterateInit(idNo) {
// Load the Google Transliterate API
google.load("elements", "1", {
packages: "transliteration"
});
var options = {
sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage: [google.elements.transliteration.LanguageCode.MALAYALAM],
shortcutKey: 'ctrl+g',
transliterationEnabled: true
};
// Create an instance on TransliterationControl with the required
// options.
var control =
new google.elements.transliteration.TransliterationControl(options);
// Enable transliteration in the textbox with id
// 'transliterateTextarea'.
var ids = ["transliterateTextarea" + idNo];
control.makeTransliteratable(ids);
}
</script>
My vue js code is: 我的Vue JS代码是:
addForm = new Vue({
el: "#addForm",
data: {
seziure: [{
details: null,
}, ],
mounted: function () {
transliterateInit(1);
},
methods: {
addNewRow: function () {
this.seziure.push({
date: null,
details: null
});
transliterateInit(this.seziure.length);
}
}
}
});
I have able to update transliteration id's. 我能够更新音译ID。
I AM NOT ABLE TO UPDATE ID's in the input fields. 我无法在输入字段中更新ID。 Please help me to update id's in the input field. 请帮助我更新输入字段中的ID。
您需要将transliterateTextarea数据放入Vue实例的数据中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.