How to watch dom

how to watch dom

<template lang="html">
<div class="a">
  <div class="goods-container">
      <div class="goods-left" ref="leftScroll">
        <ul>
          <li class="goods-left-list" :class="{"active":currentIndex===idex}" v-for="(item,idex) in goods" :key="item.name" @click="tofood(idex)">
            <span class="text border-1px">
              <span class="icon" v-if="item.type>0" :class="icon[item.type]"></span>{{item.name}}
            </span>
          </li>
        </ul>
      </div>
data() {
    return {
      goods: [],
      icon: ["decrease", "discount", "guarantee", "invoice", "special"],
      listHeight: [],
      scorllY: 0,
      foodInfo: {},
      dom: this.$refs.leftScroll
    };
  },
``

watch: {

dom(newvalue,oldvalue) {
  console.log("aaa");
  console.log(newvalue+"-------"+oldvalue);
}

},


dom for watch    
data  dom  undefinde
Jul.05,2022

do you have a look at compiling mode or introducing vue.js mode?


data ()


DOMNodeInserted

VUE core is not data-driven. This is not suitable for VUE


initializing the dom variable in data does not cause your dom node to have a reference to the variable.
but you can write like this, for example?:

  watch example . You will know the usage of  watch . 

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36eef-2c068.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36eef-2c068.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?