Some doubts about re-render of Vue

</script>
        <script>
            new Vue({
                el: "-sharpapp",
                data: function() {
                    return {
                        items: [{
                            key: "input"
                        }, {
                            key: "Re-render"
                        }],
                        formData: {
                            input: ""
                        }
                    }
                }
            })
        </script>
    </body>
</html>

as shown in the code above.

I added key to div , and the only thing that has changed is the content of formData , but when I change the value of the input box, the content of p is still re-render .

so what I want to ask is how to understand the patch calculation of Vue in this process?

and I don"t want P also re-render , what should I do?

Mar.23,2021

you can take a look at this:

ide/computed.html-sharp%E8%AE%A1%E7%AE%97%E5%B1%9E%E6%80%A7%E7%BC%93%E5%AD%98-vs-%E6%96%B9%E6%B3%95" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.

The reason why the

P tag is rerender is that Date.now () is a method , although it is not defined in the instance's methods .
and method is triggered every time template renders.

if you don't want P also rerender , you can use computed .

Menu