ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="https://cdn.bootcss.com/vue/2.5.18-beta.0/vue.js"></script> </head> <body> <div id="app"> <p @click="handleClick">{{sum}}</p> </div> <script> new Vue({ el:"#app", data:{ num1:10, num2:20 }, computed:{ sum:{ get(){ return this.num1 + this.num2 }, /* sum值改变时触发sum方法 */ set(value){ var arr = value.split(" "); this.num1 = arr[0] + "num1"; //"wnum1" this.num2 = arr[1] //d } } }, methods:{ handleClick(){ this.sum = "w d"; } } }) </script> </body> </html> ```