Skip to content
/ vue-basic-framework Public template

A simple and easy-to-use basic framework of vue

Notifications You must be signed in to change notification settings

ivshow/vue-basic-framework

Repository files navigation

以下内容自动全局导入,可直接使用


  1. component: 文件名使用-链接作为组件名,支持 jsx 写法
<nav-bar :title="$t('title')" @clickBack="onClickBack"></nav-bar>

<svg-icon name="more"></s-icon>
  1. vant:
// 组件
<van-button type="primary">主要按钮</van-button>;

// api
this.$toast('提示文案');

...
  1. vuex:
// 读取
this.vuex_loading;

// 修改
this.$vuex('vuex_loading', true);
  1. router: 页面必须为 index.vue
// 默认页面路由: 路径短杠(-)连接
1. 首页:home
2. 首页列表:home-list
3. ...

// 组件中自定义参数
export default {
  meta: {
    path: '自定义页面路径',
    title: '页面title',
    transition: true, // 默认为true
    ...
  },
}
  1. api:
this.$login();
this.$http.get();
...
  1. util:
// local-storage
this.$ls();

// dayjs
this.$dayjs();

// cookie
this.$cookie();

// event
this.$event.$on();
this.$event.$emit();

// lodash
this.$map();
this.$find();
this.$cloneDeep();
this.$$set();

// 自定义
this.$customUtil();

...
  1. scss: 内置 class,变量注入
.d-rela .d-flex .d-flex-1 .d-text-left .d-font-10 .d-m-10 .d-p-10 ...;
// js
this.$themes.black;

// scss
color: $black;
  1. 自定义 directive:
<component v-click-outside="onClickOutside"></component>
  1. vue-styled-components:
const Title = styled.div`
  color: ${props => props.color};
`;

<Title color="red">Title</Title>;

// 全局注册后
<v-title color="red">Title</v-title>;
  1. debug 模式:
http://localhost:8080/?debug=true

About

A simple and easy-to-use basic framework of vue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published