2.x版本目录:

3.0版本:

 

原来放在static下的文件,现在应该放在public文件夹下

2.x 写法:

methods: {
  fetchData () {
    let _this = this
    this.$http.get('/static/data/article.json').then(res => {
      _this.htmlText = res.data
    }).catch(err => {
      console.log('22222:', err)
    })
  }
}

3.0写法:

fetchData () {
    // this.htmlText = article[this.$route.query.id].content
  let _this = this;
    this.$http.get('/data/article.json').then(res => {
    _this.htmlText = res.data
  }).catch(err => {
    console.log('222222:', err)
  })
}

 如果json文件里有图片路径里不用加 public 

<img src=\"../../public/img/details06_3.png\" alt=\"\">

改为:

<img src=\"../../img/details06_3.png\" alt=\"\">

 

cli3.0 项目结构 及相应作用

 

Logo

前往低代码交流专区

更多推荐