Vue3 在TS中props传参 v-bind和:的细节

对于出学vue的开发者来说,v-bind这种绑定事件作为传参的手段是很常见的.

当然使用prop进行传参可能在某些情况下更有优势

在父组件中

<template>
    <div>
        <KeepAlive>
            <Com :is="current" v-bind="userProps"></Com>
        </KeepAlive>
    </div>
</template>
<script setup lang= "ts">
import Com from './com1.vue'
import {reactive} from 'vue'
//这里声明了一个对象数据 userProps
   const userProps = reactive(
    {
    id: 1,
    name: 'John Doe',
    email: 'john.doe@example.com'
    }
);


</script>

声明了一组要传递的数据,数据源可能是json静态数据也可能是一组db fetch后的结果集

这里传递的时候使用v-bind方式传递
子组件接收并显示
 

<template>
    {{ id }} -- {{ name }} -- {{ email }}
  </template>
  
  <script setup lang="ts">
  import { defineProps } from 'vue'
  
  interface UserPorps {
    id: number
    name: string
    email: string
  }
  
  const props = defineProps<UserPorps>()
  const {id, name ,email} = props
  </script>
  

 看下结果

ok其实到这里一切都还很简单.但是当我要传递一组数据的时候呢.

const userProps = ref([
    {
    id: 1,
    name: 'John Doe',
    email: 'john.doe@example.com'
    },
    {
    id: 2,
    name: 'Evan Doe',
    email: 'Evan.doe@example.com'
    },
    {
    id: 3,
    name: 'good Doe',
    email: 'good.doe@example.com'
    },
]);

修改子组件
 

<template>
    <ul>
      <li v-for="item in props" :key="item.id">
        {{ item.id }} - {{ item.name }} - {{ item.email }}
      </li>
    </ul>

  </template>
  
  <script setup lang="ts">
  import { defineProps } from 'vue'
  
  interface UserPorps {
    id: number
    name: string
    email: string
  }
  const props = defineProps<UserPorps[]>()
  </script>
  

没报错,语法正常
运行下:

没错TS+vue就是这么让你崩溃
看错误信息,是我们传递的数组类型在props中没有被识别

修改下类型.加一个别名users

  const props = defineProps<{users: UserPorps[]}>()

   替换下loop的数组name
  <li v-for="item in users" :key="item.id">

保存下,文件没有报错,语法正确,再运行下
 

 看下代码,父组件又报错了....

先说下修改的方法
将传递的绑定更换成:方式,绑定设置的别名
 

 <Com :users="userProps"></Com>

运行下

怎么说呢,总结下,跟我在写react的时候差别很大,我原想向react那种随意的流畅的传递porps直接{...props}发一个结构 对象是不可能的
官方的介绍其实有点,嗯.我理解的不透测吧.

使用一个对象绑定多个 prop

如果你想要将一个对象的所有属性都当作 props 传入,你可以使用没有参数的 v-bind,即只使用 v-bind 而非 :prop-name。例如,这里有一个 post 对象:

我天真的以为一个数组对象的porps也算做是一个对象的所有属性 

单个参数或者多个props分别传可以 
 

<ComponentA a = "y" b="x" c="z" />

只要你不嫌麻烦
优化的点放到一个对象里
就需要

const obj = {

    a: "y",
    b: "x",
    c: "z"
}

<ComponentA  v-bind="obj" />

而传递数组的数据的时候呢,又变成这样

const obj = [
{

    a: "y",
    b: "x",
    c: "z"
},
{

    a: "y1",
    b: "x1",
    c: "z1"
},
{

    a: "y3",
    b: "x3",
    c: "z3"
},
]

<ComponentA  :arr="obj" />

相应的配合TS, 在接受的时候也需要对应match上别名和接受数组类型的对象在props的定义中
 

const props = defineProps<{arr: UserPorps[]}>()

最后问题不可怕. 发现问题解决问题,了解问题原因不断成长.

D:\project\lp_leapcloud_main_web\src\components\Charts\LpCharts.vue 2:22 warning Attribute ":ref" should go before "class" vue/attributes-order 2:22 warning &#39;:ref&#39; should be on a new line vue/max-attributes-per-line 2:33 warning Require self-closing on HTML elements (<div>) vue/html-self-closing 79:5 warning Prop "unit" should define at least its type vue/require-prop-types 104:5 warning Prop &#39;chartOption&#39; requires default value to be set vue/require-default-prop 143:3 warning The "components" property should be above the "props" property on line 16 vue/order-in-components 154:3 error The `beforeDestroy` lifecycle hook is deprecated. Use `beforeUnmount` instead vue/no-deprecated-destroyed-lifecycle 162:3 error The `destroyed` lifecycle hook is deprecated. Use `unmounted` instead vue/no-deprecated-destroyed-lifecycle ✖ 8 problems (2 errors, 6 warnings) 2 errors and 4 warnings potentially fixable with the `--fix` option. 18:53:51 [vite] warning: D:\project\lp_leapcloud_main_web\src\components\Fault\FaultCase.vue 2:1 warning Expected indentation of 2 spaces but found 4 spaces vue/html-indent 3:1 warning Expected indentation of 4 spaces but found 8 spaces vue/html-indent 3:39 warning &#39;width&#39; should be on a new line vue/max-attributes-per-line 3:51 warning &#39;:title&#39; should be on a new line vue/max-attributes-per-line 3:66 warning &#39;:before-close&#39; should be on a new line vue/max-attributes-per-line 3:94 warning &#39;destroy-on-close&#39; should be on a new line vue/max-attributes-per-line 4:1 warning Expected indentation of 6 spaces but found 12 spaces vue/html-indent 4:45 warning &#39;label-width&#39; should be on a new line vue/max-attributes-per-line 4:65 warning &#39;:model&#39; should be on a new line vue/max-attributes-per-line 4:84 warning Attribute "ref" should go before ":model" vue/attributes-order 4:84 warning &#39;ref&#39; should be on a new line vue/max-attributes-per-line 4:100 warning &#39;:rules&#39; should be on a new line vue/max-attributes-per-line 5:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 6:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 6:26 warning Expected 1 space after &#39;{{&#39;, but not found vue/mustache-interpolation-spacing 6:77 warning Expected 1 space before &#39;}}&#39;, but not found vue/mustache-interpolation-spacing 7:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 8:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 9:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 10:1 warning Expected indentation of 12 spaces but found 24 spaces vue/html-indent 10:47 warning Require self-closing on Vue.js custom components (<el-radio>) vue/html-self-closing 11:1 warning Expected indentation of 12 spaces but found 24 spaces vue/html-indent 11:47 warning Require self-closing on Vue.js custom components (<el-radio>) vue/html-self-closing 12:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 13:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 14:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 14:43 warning &#39;prop&#39; should be on a new line vue/max-attributes-per-line 15:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 15:43 warning Attribute "v-model" should go before "type" vue/attributes-order 15:43 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 15:52 error Unexpected mutation of "faultForm" prop vue/no-mutating-props 15:73 warning &#39;maxLength&#39; should be on a new line vue/max-attributes-per-line 15:73 warning Attribute &#39;maxLength&#39; must be hyphenated vue/attribute-hyphenation 15:83 warning Expected to be enclosed by double quotes vue/html-quotes 15:88 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 15:109 warning Require self-closing on Vue.js custom components (<el-input>) vue/html-self-closing 16:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 17:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 17:44 warning &#39;prop&#39; should be on a new line vue/max-attributes-per-line 18:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 18:47 warning Attribute "v-model" should go before "type" vue/attributes-order 18:47 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 18:56 error Unexpected mutation of "faultForm" prop vue/no-mutating-props 18:76 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 18:98 warning &#39;maxlength&#39; should be on a new line vue/max-attributes-per-line 18:115 warning Require self-closing on Vue.js custom components (<el-input>) vue/html-self-closing 19:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 20:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 20:44 warning &#39;prop&#39; should be on a new line vue/max-attributes-per-line 21:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 21:47 warning Attribute "v-model" should go before "type" vue/attributes-order 21:47 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 21:56 error Unexpected mutation of "faultForm" prop vue/no-mutating-props 21:74 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 21:96 warning &#39;maxlength&#39; should be on a new line vue/max-attributes-per-line 21:113 warning Require self-closing on Vue.js custom components (<el-input>) vue/html-self-closing 22:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 23:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 24:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 24:44 warning &#39;@click&#39; should be on a new line vue/max-attributes-per-line 24:66 warning Expected 1 line break after opening tag (`<el-button>`), but no line breaks found vue/singleline-html-element-content-newline 24:68 warning Expected 1 line break before closing tag (`</el-button>`), but no line breaks found vue/singleline-html-element-content-newline 25:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 25:47 warning &#39;@click&#39; should be on a new line vue/max-attributes-per-line 25:67 warning Expected 1 line break after opening tag (`<el-button>`), but no line breaks found vue/singleline-html-element-content-newline 25:69 warning Expected 1 line break before closing tag (`</el-button>`), but no line breaks found vue/singleline-html-element-content-newline 26:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 27:1 warning Expected indentation of 6 spaces but found 12 spaces vue/html-indent 28:1 warning Expected indentation of 4 spaces but found 8 spaces vue/html-indent 29:1 warning Expected indentation of 2 spaces but found 4 spaces vue/html-indent 38:9 warning Prop &#39;title&#39; requires default value to be set vue/require-default-prop 39:9 warning Prop &#39;faultForm&#39; requires default value to be set vue/require-default-prop 51:9 warning Prop &#39;parentFunc&#39; requires default value to be set vue/require-default-prop 99:24 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 122:44 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 127:44 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 136:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 140:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 148:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 152:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 164:5 warning The "destroyed" property should be above the "methods" property on line 97 vue/order-in-components 164:5 error The `destroyed` lifecycle hook is deprecated. Use `unmounted` instead vue/no-deprecated-destroyed-lifecycle ✖ 82 problems (4 errors, 78 warnings) 1 error and 56 warnings potentially fixable with the `--fix` option. Plugin: vite-plugin-eslint File: D:/project/lp_leapcloud_main_web/src/components/Fault/FaultCase.vue D:\project\lp_leapcloud_main_web\src\components\Fault\FaultCase.vue 2:1 warning Expected indentation of 2 spaces but found 4 spaces vue/html-indent 3:1 warning Expected indentation of 4 spaces but found 8 spaces vue/html-indent 3:39 warning &#39;width&#39; should be on a new line vue/max-attributes-per-line 3:51 warning &#39;:title&#39; should be on a new line vue/max-attributes-per-line 3:66 warning &#39;:before-close&#39; should be on a new line vue/max-attributes-per-line 3:94 warning &#39;destroy-on-close&#39; should be on a new line vue/max-attributes-per-line 4:1 warning Expected indentation of 6 spaces but found 12 spaces vue/html-indent 4:45 warning &#39;label-width&#39; should be on a new line vue/max-attributes-per-line 4:65 warning &#39;:model&#39; should be on a new line vue/max-attributes-per-line 4:84 warning Attribute "ref" should go before ":model" vue/attributes-order 4:84 warning &#39;ref&#39; should be on a new line vue/max-attributes-per-line 4:100 warning &#39;:rules&#39; should be on a new line vue/max-attributes-per-line 5:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 6:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 6:26 warning Expected 1 space after &#39;{{&#39;, but not found vue/mustache-interpolation-spacing 6:77 warning Expected 1 space before &#39;}}&#39;, but not found vue/mustache-interpolation-spacing 7:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 8:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 9:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 10:1 warning Expected indentation of 12 spaces but found 24 spaces vue/html-indent 10:47 warning Require self-closing on Vue.js custom components (<el-radio>) vue/html-self-closing 11:1 warning Expected indentation of 12 spaces but found 24 spaces vue/html-indent 11:47 warning Require self-closing on Vue.js custom components (<el-radio>) vue/html-self-closing 12:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 13:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 14:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 14:43 warning &#39;prop&#39; should be on a new line vue/max-attributes-per-line 15:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 15:43 warning Attribute "v-model" should go before "type" vue/attributes-order 15:43 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 15:52 error Unexpected mutation of "faultForm" prop vue/no-mutating-props 15:73 warning &#39;maxLength&#39; should be on a new line vue/max-attributes-per-line 15:73 warning Attribute &#39;maxLength&#39; must be hyphenated vue/attribute-hyphenation 15:83 warning Expected to be enclosed by double quotes vue/html-quotes 15:88 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 15:109 warning Require self-closing on Vue.js custom components (<el-input>) vue/html-self-closing 16:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 17:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 17:44 warning &#39;prop&#39; should be on a new line vue/max-attributes-per-line 18:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 18:47 warning Attribute "v-model" should go before "type" vue/attributes-order 18:47 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 18:56 error Unexpected mutation of "faultForm" prop vue/no-mutating-props 18:76 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 18:98 warning &#39;maxlength&#39; should be on a new line vue/max-attributes-per-line 18:115 warning Require self-closing on Vue.js custom components (<el-input>) vue/html-self-closing 19:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 20:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 20:44 warning &#39;prop&#39; should be on a new line vue/max-attributes-per-line 21:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 21:47 warning Attribute "v-model" should go before "type" vue/attributes-order 21:47 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 21:56 error Unexpected mutation of "faultForm" prop vue/no-mutating-props 21:74 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 21:96 warning &#39;maxlength&#39; should be on a new line vue/max-attributes-per-line 21:113 warning Require self-closing on Vue.js custom components (<el-input>) vue/html-self-closing 22:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 23:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 24:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 24:44 warning &#39;@click&#39; should be on a new line vue/max-attributes-per-line 24:66 warning Expected 1 line break after opening tag (`<el-button>`), but no line breaks found vue/singleline-html-element-content-newline 24:68 warning Expected 1 line break before closing tag (`</el-button>`), but no line breaks found vue/singleline-html-element-content-newline 25:1 warning Expected indentation of 10 spaces but found 20 spaces vue/html-indent 25:47 warning &#39;@click&#39; should be on a new line vue/max-attributes-per-line 25:67 warning Expected 1 line break after opening tag (`<el-button>`), but no line breaks found vue/singleline-html-element-content-newline 25:69 warning Expected 1 line break before closing tag (`</el-button>`), but no line breaks found vue/singleline-html-element-content-newline 26:1 warning Expected indentation of 8 spaces but found 16 spaces vue/html-indent 27:1 warning Expected indentation of 6 spaces but found 12 spaces vue/html-indent 28:1 warning Expected indentation of 4 spaces but found 8 spaces vue/html-indent 29:1 warning Expected indentation of 2 spaces but found 4 spaces vue/html-indent 38:9 warning Prop &#39;title&#39; requires default value to be set vue/require-default-prop 39:9 warning Prop &#39;faultForm&#39; requires default value to be set vue/require-default-prop 51:9 warning Prop &#39;parentFunc&#39; requires default value to be set vue/require-default-prop 99:24 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 122:44 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 127:44 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 136:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 140:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 148:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 152:48 warning The "update:visible" event has been triggered but not declared on `emits` option vue/require-explicit-emits 164:5 warning The "destroyed" property should be above the "methods" property on line 97 vue/order-in-components 164:5 error The `destroyed` lifecycle hook is deprecated. Use `unmounted` instead vue/no-deprecated-destroyed-lifecycle ✖ 82 problems (4 errors, 78 warnings) 1 error and 56 warnings potentially fixable with the `--fix` option. 18:53:51 [vite] warning: D:\project\lp_leapcloud_main_web\src\components\CarSearch\CommChartHeader.vue 8:17 warning Attribute &#39;:isClearable&#39; must be hyphenated vue/attribute-hyphenation 8:44 warning &#39;:carType.sync&#39; should be on a new line vue/max-attributes-per-line 8:44 warning Attribute &#39;:carType.sync&#39; must be hyphenated vue/attribute-hyphenation 8:44 error &#39;.sync&#39; modifier on &#39;v-bind&#39; directive is deprecated. Use &#39;v-model:propName&#39; instead vue/no-deprecated-v-bind-sync 8:82 warning &#39;isNormal&#39; should be on a new line vue/max-attributes-per-line 8:82 warning Attribute &#39;isNormal&#39; must be hyphenated vue/attribute-hyphenation 8:91 warning &#39;style&#39; should be on a new line vue/max-attributes-per-line 8:117 warning Require self-closing on Vue.js custom components (<car-type>) vue/html-self-closing 9:43 warning Attribute "v-model" should go before "class" vue/attributes-order 9:43 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 9:80 warning &#39;align&#39; should be on a new line vue/max-attributes-per-line 9:94 warning &#39;type&#39; should be on a new line vue/max-attributes-per-line 9:106 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 9:129 warning &#39;:picker-options&#39; should be on a new line vue/max-attributes-per-line 9:161 warning Require self-closing on Vue.js custom components (<el-date-picker>) vue/html-self-closing 10:50 warning &#39;class&#39; should be on a new line vue/max-attributes-per-line 10:81 warning &#39;:vinOrNum.sync&#39; should be on a new line vue/max-attributes-per-line 10:81 warning Attribute &#39;:vinOrNum.sync&#39; must be hyphenated vue/attribute-hyphenation 10:81 error &#39;.sync&#39; modifier on &#39;v-bind&#39; directive is deprecated. Use &#39;v-model:propName&#39; instead vue/no-deprecated-v-bind-sync 10:117 warning &#39;:multiple&#39; should be on a new line vue/max-attributes-per-line 10:134 warning &#39;:carType&#39; should be on a new line vue/max-attributes-per-line 10:134 warning Attribute &#39;:carType&#39; must be hyphenated vue/attribute-hyphenation 10:167 warning Require self-closing on Vue.js custom components (<car-select>) vue/html-self-closing 11:18 warning Attribute &#39;:componentData&#39; must be hyphenated vue/attribute-hyphenation 11:49 warning Require self-closing on Vue.js custom components (<car-miles>) vue/html-self-closing 12:33 warning &#39;@click&#39; should be on a new line vue/max-attributes-per-line 12:48 warning Expected 1 line break after opening tag (`<el-button>`), but no line breaks found vue/singleline-html-element-content-newline 12:50 warning Expected 1 line break before closing tag (`</el-button>`), but no line breaks found vue/singleline-html-element-content-newline 23:5 warning Prop &#39;onOk&#39; requires default value to be set vue/require-default-prop 26:5 warning Prop &#39;carType&#39; requires default value to be set vue/require-default-prop 36:3 warning The "data" property should be above the "mounted" property on line 33 vue/order-in-components 54:3 warning The "components" property should be above the "props" property on line 22 vue/order-in-components 55:5 error The "LpArea" component has been registered but not used vue/no-unused-components33 problems (3 errors, 30 warnings) 2 errors and 17 warnings potentially fixable with the `--fix` option. Plugin: vite-plugin-eslint File: D:/project/lp_leapcloud_main_web/src/components/CarSearch/CommChartHeader.vue D:\project\lp_leapcloud_main_web\src\components\CarSearch\CommChartHeader.vue 8:17 warning Attribute &#39;:isClearable&#39; must be hyphenated vue/attribute-hyphenation 8:44 warning &#39;:carType.sync&#39; should be on a new line vue/max-attributes-per-line 8:44 warning Attribute &#39;:carType.sync&#39; must be hyphenated vue/attribute-hyphenation 8:44 error &#39;.sync&#39; modifier on &#39;v-bind&#39; directive is deprecated. Use &#39;v-model:propName&#39; instead vue/no-deprecated-v-bind-sync 8:82 warning &#39;isNormal&#39; should be on a new line vue/max-attributes-per-line 8:82 warning Attribute &#39;isNormal&#39; must be hyphenated vue/attribute-hyphenation 8:91 warning &#39;style&#39; should be on a new line vue/max-attributes-per-line 8:117 warning Require self-closing on Vue.js custom components (<car-type>) vue/html-self-closing 9:43 warning Attribute "v-model" should go before "class" vue/attributes-order 9:43 warning &#39;v-model&#39; should be on a new line vue/max-attributes-per-line 9:80 warning &#39;align&#39; should be on a new line vue/max-attributes-per-line 9:94 warning &#39;type&#39; should be on a new line vue/max-attributes-per-line 9:106 warning &#39;placeholder&#39; should be on a new line vue/max-attributes-per-line 9:129 warning &#39;:picker-options&#39; should be on a new line vue/max-attributes-per-line 9:161 warning Require self-closing on Vue.js custom components (<el-date-picker>) vue/html-self-closing 10:50 warning &#39;class&#39; should be on a new line vue/max-attributes-per-line 10:81 warning &#39;:vinOrNum.sync&#39; should be on a new line vue/max-attributes-per-line 10:81 warning Attribute &#39;:vinOrNum.sync&#39; must be hyphenated vue/attribute-hyphenation 10:81 error &#39;.sync&#39; modifier on &#39;v-bind&#39; directive is deprecated. Use &#39;v-model:propName&#39; instead vue/no-deprecated-v-bind-sync 10:117 warning &#39;:multiple&#39; should be on a new line vue/max-attributes-per-line 10:134 warning &#39;:carType&#39; should be on a new line vue/max-attributes-per-line 10:134 warning Attribute &#39;:carType&#39; must be hyphenated vue/attribute-hyphenation 10:167 warning Require self-closing on Vue.js custom components (<car-select>) vue/html-self-closing 11:18 warning Attribute &#39;:componentData&#39; must be hyphenated vue/attribute-hyphenation 11:49 warning Require self-closing on Vue.js custom components (<car-miles>) vue/html-self-closing 12:33 warning &#39;@click&#39; should be on a new line vue/max-attributes-per-line 12:48 warning Expected 1 line break after opening tag (`<el-button>`), but no line breaks found vue/singleline-html-element-content-newline 12:50 warning Expected 1 line break before closing tag (`</el-button>`), but no line breaks found vue/singleline-html-element-content-newline 23:5 warning Prop &#39;onOk&#39; requires default value to be set vue/require-default-prop 26:5 warning Prop &#39;carType&#39; requires default value to be set vue/require-default-prop 36:3 warning The "data" property should be above the "mounted" property on line 33 vue/order-in-components 54:3 warning The "components" property should be above the "props" property on line 22 vue/order-in-components 55:5 error The "LpArea" component has been registered but not used vue/no-unused-components33 problems (3 errors, 30 warnings) 2 errors and 17 warnings potentially fixable with the `--fix` option. 18:53:52 [vite] warning: D:\project\lp_leapcloud_main_web\src\App.vue 2:1 warning Expected indentation of 2 spaces but found 4 spaces vue/html-indent 3:1 warning Expected indentation of 4 spaces but found 8 spaces vue/html-indent 3:22 warning Require self-closing on Vue.js custom components (<router-view>) vue/html-self-closing 4:1 warning Expected indentation of 2 spaces but found 4 spaces vue/html-indent ✖ 4 problems (0 errors, 4 warnings) 0 errors and 4 warnings potentially fixable with the `--fix` option. Plugin: vite-plugin-eslint File: D:/project/lp_leapcloud_main_web/src/App.vue?vue&type=style&index=0&lang.css 是不是vue2不应该迁移vite
07-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值