The error message indicates that there is a problem with the template in the file "code.vue" at line 6.

The error specifically states that a component template should contain exactly one root element, but it seems that there are multiple root elements in the template. The error points to the opening tag of the "line" element as the problematic element.

To resolve this issue, you need to ensure that there is only one root element in the template. If you are using v-if on multiple elements, you can use v-else-if to chain them instead.

Here's an example of how you can modify the template to have a single root element:

<template>
  <div>
    <input class="price" type="number" placeholder="输入金额" v-model="info.money"/>
    <view class="line line1">
      <view class="line1-title">使用ZJT</view>
      <switch :checked="info.useQt!=0" color="#0E7519" style="transform:scale(0.7)" @change="onChangeQtCoupon"/>
    </view>
    <!-- Rest of the template -->
  </div>
</template>

Make sure to adjust the rest of the template accordingly to have a single root element.

Failed to compileEqinghezhifupagesindexcodevuevue&type=template&id=0435a57a&scoped=true& node_modulesdcloudiovue-cli-plugin-unipackagesvue-loaderlibloaderstemplateLoaderjsvue-loader-options!node_modul

原文地址: https://www.cveoy.top/t/topic/jgJ2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录