关于安装,个人git有点慢,下载不下来,所以用zip
Windows 用户若安装不成功,很大概率是node-sass安装失败,个人解决方案是:
1、npm install sass-loader --save-dev
2、cnpm install node-sass --save-dev
这个项目有用到vuex,就是store状态管理,如果没有这方面的知识,必须要补习下,不然找不到北!可以参照:https://segmentfault.com/a/1190000015782272 学习下!
这里讲下。调用自己的接口和跨域的问题:
在.env.development的文件中改掉域名:
#VUE_APP_BASE_API = '/dev-api' VUE_APP_BASE_API = 'http://localhost:8086/'
接着在自己学想java api后台启用cross
package richstore.com.rich_shop.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class cross extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.maxAge(3600)
.allowCredentials(true);
}
}