How to get an element group in vue

there is a group of li, under ul. I want to dynamically modify the width of ul according to the number of li. How to get all the li,ref in vue is to get the specified dom,. If it is native to get dom, I want to ask how to implement vue.

Mar.15,2021

<template>
  <ul ref="uldom">
    <li></li>
    <li></li>
    <li></li>
  </ul>
</template>
<script>
export default {
  mounted () {
    console.log(this.$refs.uldom.children)  // this.$refs.uldom uldom .children js 
  }
}
</script>

using ref is the best choice. It can effectively reduce the resource consumption caused by dom operations

Menu