npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@liguang/vue-elementui-customized

v0.1.14

Published

自定义了Input、InputNumber、Loading、Tooltip、Upload、Dialog 以及 Clickoutside

Downloads

576

Readme

说明

ElementUI

使用时,需要在 vue.config.js 中配置 alias 如下(因为在Element源码内部,也使用了 element-ui 别名):

样式文件要单独引入 require('@liguang/vue-elementui-customized/src/elementui/packages/theme-chalk/src/index.scss')

const path = require('path')

function resolve (dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  runtimeCompiler: true,
  transpileDependencies: [
    // 默认babel-loader忽略mode_modules,这里要让其编译
    '@liguang/vue-elementui-customized'
  ]
  chainWebpack: (config) => {
    config.resolve.alias
      .set('element-ui', resolve('@liguang/vue-elementui-customized/src/elementui'))
  }
}

自定义了Input、InputNumber、Loading、Tooltip、Upload 以及 Clickoutside,详见相应目录的 readme.md

Modal部分

如果注入router,当页面切换时,弹框会自动关闭。 此模块大大方便了Modal的使用,使用方式如下:

1. 编写Modal组件
// TestModal.vue
<template>
    <el-dialog title="测试">
        // 省略
    </el-dialog>
</template>
<script>
import ModalMixin from '@liguang/vue-elementui-customized/modal/modal-mixin'
export default {
  mixins: [ModalMixin],
  methods: {
    init (arg0, arg1, ....) {
      // 这里必须返回 this.open()
      return this.open()
    }
  }
}
</script>
2. 初始化
import Modal from '@liguang/vue-elementui-customized/modal'
// 参数为待注入的对象,是可选项
Modal.initModal({
  store,
  router
})
Vue.use(Modal)
3. 注册Modal组件
import TestModal from './models/TestModal.vue'
import Modal from '@liguang/vue-elementui-customized/modal'

let modals = {
  TestModal
}
for (let key in modals) {
  if (modals.hasOwnProperty(key)) {
    Modal.registerModal(key, modals[key])
  }
}
4. 使用
import Vue from 'vue'
let rst = Vue.prototype.modal('TestModal', arg0, arg1, ...)
// 这里返回值中包含 modal 实例,以及 promise(当Modal关闭时,主动调用关闭时会执行resolve,参数为close方法调用时的参数, 非主动调用关闭时执行reject(-1)
console.log(rst.modal)
rst.promise.then(data => {
  console.log(data)
}).catch(err => {
  console.log(err)
})

示例

查看示例