放到beforeCreated方法里面即可。
mounted() 生命周期 里也行
不要用alert了,用confirm。
```bash var r = confirm(6); if (r == true) { x = "您按了确认!"; } else { x = "您按了取消!"; }
```