looking for some solutions? You are welcome.

SOLVED: Unexpected token, expected ","

Yuuki Yamada:

I've got a SyntaxError:

Unexpected token, expected "," (1:592)

in my NewPizza.vue file.

I tried to add , to every brace but it didn't solve the error.

Here is my source code:

<template>
    <form>
        <h3>Add new pizza:</h3>

        <div class="form-group row">
            <label class="col-sm-3">Name</label>
            <div class="col-sm-9">
                <input type="text" class="form-control" v-model="newPizza.name">
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-3">Description</label>
            <div class="col-sm-9">
                <textarea type="text" class="form-control" rows="5" v-model="newPizza.description"></textarea>
            </div>
        </div>

        <p><strong>Option 1:</strong></p>
        <div class="form-group row">
            <label class="col-sm-3">Size (")</label>
            <div class="col-sm-9">
                <input type="text" class="form-control" v-model="newPizza.options[0].size">
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-3">Price</label>
            <div class="col-sm-9">
                <input type="text" class="form-control" v-model="newPizza.options[0].price">
            </div>
        </div>

        <p><strong>Option 2:</strong></p>
        <div class="form-group row">
            <label class="col-sm-3">Size (")</label>
            <div class="col-sm-9">
                <input type="text" class="form-control" v-model="newPizza.options[1].size">
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-3">Price</label>
            <div class="col-sm-9">
                <input type="text" class="form-control" v-model="newPizza.options[1].price">
            </div>
        </div>

        <div class="form-group row">
            <button type="button" class="btn btn-success btn-block">Add</button>
        </div>
    </form>
</template>

<script>
export default {
    data(){
        return {
            newPizza:{
                'name': 'Eg. Margherita',
                'description': 'Eg. A delicious tomato based pizza topped with mozzarella',
                'options': [{
                    'size': 9,
                    'price': 6.95
                }, {
                    'size': 12,
                    'price': 10.95
                }]
            }
        }
    }
}
</script>

what should I do?

In my opinion, I think the template part doesn't have any problem. But when I add v-model directive to every input tag, the code throws the error.

Error screen image



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent