shimohq / react-cookbook

编写简洁漂亮,可维护的 React 应用

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

计算属性直接使用get会报错,如何设置set更优雅那?

PeanutQAQ opened this issue · comments

尝试使用get来设置某个参数,结果报TypeError: Cannot set property hoverText of # which has only a getter。加了个set函数,但是很丑陋。
set hoverText(no) {
this._hoverText = 0;
}
请问有什么处理的建议吗?