自学内容网 自学内容网

从零创建vue+elementui+sass+three.js项目

初始化:

vue init webpack projectname
cd projectname
npm install

支持sass:

npm install sass --save-dev
npm install sass-loader@7.1.0 --save-dev
npm install node-sass@4.12.0 --save-dev

build/webpack.base.conf.js添加

rules: [
...,
      {
        test: /\.scss$/,
        loaders: ['style', 'css', 'sass']
      }
     ]

安装three.js:

npm install --save three@0.128.0

安装elementui:

npm i element-ui -S

安装vuex:

npm install vuex@3.1.0 --save

main.js初始化:

import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store';

Vue.config.productionTip = false

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})

vuex初始化:

import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const state = {
    position: { x: 0, y: 0, z: 0 },
    rotation: { x: 0, y: 0, z: 0 },
    scale: { x: 1,y: 1,z: 1 }
}
const mutations = {
    SET_POSITION:(state, data) => {
        // console.log('SET_POSITION', state, data);
        state.positon = data;
    },
    SET_ROTATION:(state, data) => {
        // console.log('SET_ROTATION', state, data);
        state.rotation = data;
    },
    SET_SCALE:(state, data) => {
        state.scale = data;
    }
}
const actions = {

}
const store = new Vuex.Store({
    state,
    mutations
});
export default store

打包后找不到js,css
全局搜索assetsPublicPath
在这里插入图片描述
打包后elementui的icon丢失问题(去掉limit限制):
在这里插入图片描述


原文地址:https://blog.csdn.net/qq_34568700/article/details/143643024

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!