// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import Bmob from "hydrogen-js-sdk"
Vue.config.productionTip = false
//初始化
Bmob.initialize("99707c10d793802884aed15928875f7d", "f2b754f430ec3f5a527538956242d918");
// 挂载到全局使用
Vue.prototype.Bmob = Bmob
Vue.use(VueResource)
Vue.use(VueRouter)
//全局API,自定义指令和过滤器等
//自定义指令
//Vue.directive('rainbow',{
//把rainbow绑定
//el绑定的元素,binding可以拿到绑定的参数
// bind(el,binding,vnode){
// el.style.color = "#"+Math.random().toString(16).slice(2,8);
// }
//})
Vue.directive('theme',{
//v-theme:column="'narrow' 拿值 .value
bind(el,binding,vnode){
if(binding.value == 'wide'){
el.style.maxWidth = "1260px";
}else if(binding.value == 'narrow'){
el.style.maxWidth = "560px";
}
//v-theme:column="'narrow' 拿参数 .arg
if(binding.arg == 'column'){
el.style.background = "#6677cc";
el.style.padding = "20px";
}
}
})
//自定义过滤器, 管道前面的值就传递给了value
//Vue.filter("to-uppercase",function(value){
// return value.toUpperCase();
//})
//自定义过滤器截取前100个字符
Vue.filter("snippet",function (value) {
return value.slice(0,100)+"...";
})
//引入自己创建的路由配置文件
import Routes from './routes'
//创建路由
const router = new VueRouter({
routes:Routes,
mode:"history"
})
/* eslint-disable no-new */
new Vue({
el: '#app',
components: { App },
template: '<App/>',
//使用路由
router: router,
//render: h => h(App)
})