This time I will bring you the calculation properties and data monitoring of Vue.js. What are the precautions for Vue.js calculation properties and data monitoring. The following is a practical case. Let’s take a look.
Computed attribute computed
Requirement: Replace the numbers in the form input content
<template> <div id="myapp"> {{myValueWithoutNum}} <br> <input type="text" v-model="myValue"> </div></template><script> export default { data () { return { myValue: '' } },// 计算属性 computed: { myValueWithoutNum () {// 把输入的数字替换为空 return this.myValue.replace(/\d/g, '') } } }</script>
The above effect
The above is the detailed content of Computed properties and data monitoring in Vue.js. For more information, please follow other related articles on the PHP Chinese website!