Coder Social home page Coder Social logo

jnotice's Introduction

jnotice

安装

npm install @jdorg/jnotice --save

使用

先引入:

import JNotice from '@jdorg/jnotice'

import '@jdorg/jnotice/dist/jnotice.css'

Vue.use(JNotice)

然后在vue实例中:

this.$jnotice(setup:jnoticeSetup) // setup 为jnoticeSetup类型的对象

说明

接口:

interface jnoticeSetup {
  text?:string;   // 要显示的文字
  duraiton?:number; // 多久会消失
  position?:'top'|'bottom'|'t-left'|'b-left'|'t-right'|'b-right'; // 所在位置
  background?:string; // 与css一致
  color?:string; // 与css一致
  width?:string; // 与css一致
  mheight?:string; // 与css min-height一致
  type?:'info'|'success'|'error';  // icon 类型
}

默认值:

const jnoticeDefaultSetup:jnoticeSetup = {
  text: 'This is jnotice!',
  duraiton: 3000,
  position: 'top',
  background: '#ddd',
  color: '#000',
  width: '400px',
  mheight: '50px',
  type: 'info'
}

example

<div id="app">
  <button class="btn" @click="click">Click to jnotice!</button>
</div>
export default class App extends Vue {
  public click() {
    this.$jnotice({
      background: '#424242',
      color: '#fff',
      position: 'top'
    })
  }
}
#app {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.btn {
  width: 200px;
  height: 80px;
}

example

others

@jdorg是一个开源前端组件的社区,如果你有开源组件的想法,欢迎加入我们

qqgroup

jnotice's People

Watchers

渐冬橙 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.