如何获得所有票价的总和

时间:2018-10-26 22:52:16

标签: javascript html laravel vue.js vuejs2

我正在使用navbar-fixedLaravel 5.7 ...

我想获取我的VueJs 2.5.*中所有票价的总和。我在玩耍,但是没有成功...

这是我的TotalFares Fares

<Input>

这是我的<tr v-for="(ticketInvoiceItem, key) in form.ticketInvoiceItems" :key="key"> <td> <input v-model.number="ticketInvoiceItem.fares" type="number" size="10" name="fares" class="table-control form-control" :class="{ 'is-invalid': form.errors.has('fares') }"> <has-error :form="form" field="fares"></has-error> </td> </tr> TotalFares

<input>

我在<tfoot class="tfoot"> <tr> <td class="table-amount"> <input :value="getFareTotal()" type="text" name="ticket_invoice_fares_total" class="form-control" :class="{ 'is-invalid': form.errors.has('ticket_invoice_fares_total') }"> </td> </tr> </tfoot> 中的data()

VueJs

我试图获得data() { return { ticketInvoices: {}, vendors: null, form: new Form({ id: "", vendor_id: "", ticket_invoice_no: "", ticket_invoice_date: "", ticket_invoice_fares_total: "", ticketInvoiceItems: [{ id: "", ticket_invoice_id: "", passenger_name: "", fares: 0, }] }) } }, 这样的东西,但失败了:

FaresTotal

1 个答案:

答案 0 :(得分:2)

// Define your NotUnderstood template
[Serializable, Template(TemplateUsage.NotUnderstood, NOT_UNDERSTOOD)]
public class MainReq
{
    public const string NOT_UNDERSTOOD = "Not-understood message";

    [Prompt("Indicare la tipologia della richiesta? {||}")]
    public MainOptions? MainOption;

    public static IForm<MainReq> BuildForm()
    {
        var form = (new FormBuilder<MainReq>()
            .Prompter(PromptAsync)  // Build your form with a custom prompter
            .Build());

        return form;
    }

    private static async Task<FormPrompt> PromptAsync(IDialogContext context, FormPrompt prompt, MainReq state, IField<MainReq> field)
    {
        var preamble = context.MakeMessage();
        var promptMessage = context.MakeMessage();

        if (prompt.GenerateMessages(preamble, promptMessage))
        {
            await context.PostAsync(preamble);
        }

        // Here is where we've made a change to the default prompter.
        if (promptMessage.Text == NOT_UNDERSTOOD)
        {
            // Access the message the user typed with context.Activity
            await context.PostAsync($"Do what you want with the message: {context.Activity.AsMessageActivity()?.Text}");
        }
        else
        {
            await context.PostAsync(promptMessage);
        }

        return prompt;
    }
}

ticketInvoiceItems是一个集合。因此,您必须对其进行迭代。