2017-11-10 9 views
0

チェーンに-場合は、V-他の利用、V-あれば複数の要素上を使用している場合は、私と私は、とても混乱していコンポーネントテンプレートには、正確に1つのルート要素が含まれている必要があります。あなたは彼らが代わりに

<template> 
<div v-if="alert.message" :class="['alert alert-' + alert.type]"> 
    <p>{{ alert.message }}</p> 
</div> 
<div class="col-md-4"> 
    <div :class="['form-group', 'label-floating',{ 'has-error' : errors.city}]"> 
     <label class="control-label">Kota</label> 
     <select @change="city" v-model="state.city" class="form-control" required> 
     <option v-for="city in cities" :value="city.kota_id">{{city.kota_nama}}</option> 
     </select> 
     <span v-if="errors.city" class="label label-danger"> 
     {{ errors.city[0]}} 
     </span> 
    </div> 
</div> 
<div class="col-md-4"> 
    <div :class="['form-group', 'label-floating',{ 'has-error' : errors.profile}]"> 
     <label class="control-label">Tahun</label> 
     <select @change="profile" v-model="state.profle" class="form-control" required> 
     <option v-for="profile in profiles" :value="profile.profile_id">{{profile.profile_tahun}}</option> 
     </select> 
     <span v-if="errors.profile" class="label label-danger"> 
     {{ errors.profile[0]}} 
     </span> 
    </div> 
</div> 

ここに私のForm.vueコードを助けてくださいエラー...私がv-ショーを変更しようと、まだ

Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead. 

答えて

1

のようなエラーがそれはあなたが<template></template>の内側に置く何が別の要素の内部で行ってされるべきであることを意味ます。

だから、いつものようにこれらのタグ内の1つのdiv要素を作成します。もちろん

<template> 
    <div> 
     <!-- put all your code here --> 
    </div> 
</template> 
+0

行われ、それでもエラーが何である –

+0

をエラー? – samayo

+0

申し訳ありません:Dはそれほど多くの仲間に感謝しました –

関連する問題