There is a question that the component written by vue needs $emit to modify the value of the parent component, but the UI framework does not need me to do this. How can I write it like the UI framework?

vue write component
props after receiving the parameters, if you need to modify the parameters
for example, the following figure

$emit
add minus
UI
element-ui UI add minus

$emit

as above, the InputNumber of element-ui
does not need to enter add and minus, but can change the value normally

Jun.28,2022

provide/inject find out. ide-inject" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/api/-sharp...


at least element-ui and iview are useful to $emit, but we don't need to use $emit
such as @ current-change= "handleCurrentChange"
code address in the following code: http://element-cn.eleme.io/-sharp/...

.
<template>
  <el-table
    ref="singleTable"
    :data="tableData"
    highlight-current-row
    @current-change="handleCurrentChange"
    style="width: 100%">
    <el-table-column
      type="index"
      width="50">
    </el-table-column>
    <el-table-column
      property="date"
      label=""
      width="120">
    </el-table-column>
    <el-table-column
      property="name"
      label=""
      width="120">
    </el-table-column>
    <el-table-column
      property="address"
      label="">
    </el-table-column>
  </el-table>
  <div style="margin-top: 20px">
    <el-button @click="setCurrent(tableData[1])"></el-button>
    <el-button @click="setCurrent()"></el-button>
  </div>
</template>

is implemented in the el-table component through the following code

table.$emit('current-change', null, oldCurrentRow);
Menu