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


在idea的控制台輸入umi dev

 

在網頁中輸入網址http://localhost:8000之后

問題如下,當我刷新頁面后,沒有結果

 

生成的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文件的開頭位置加上即可

效果如下:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM