在idea的控制台输入umi dev

The development server has disconnected. Refresh the page if necessary.

 

在网页中输入网址http://localhost:8000之后

问题如下,当我刷新页面后,没有结果

The development server has disconnected. Refresh the page if necessary.

 

生成的index.js,改了之后是这样的

@T // 通过@符号进行引用该方法,类似java中的注释
class User{
  constructor(name, age = 20) {
    this.name = name;
    this.age = age;
  }
}

function T(target) { // 定义一个普通的方法
  console.log(target); // target对象为修饰的目标对象,这里是user对象
  target.country = "中国"; // 为User类添加一个静态属性country
}

console.log(User.country); // 打印出country属性值

原因是因为原来生成的index.js文件中有一句:

export default ()=><div></div>;

所以只要在index.js文件的开头位置加上即可

效果如下:

The development server has disconnected. Refresh the page if necessary.

 

相关文章:

  • 2022-12-23
  • 2021-04-09
  • 2022-12-23
  • 2022-01-09
  • 2022-01-21
  • 2021-10-22
  • 2021-06-20
  • 2021-12-02
猜你喜欢
  • 2021-07-22
  • 2021-10-26
  • 2021-04-28
  • 2021-08-09
  • 2022-12-23
  • 2021-10-05
  • 2021-09-21
相关资源
相似解决方案