初始化:
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限制):