0.2.0 • Published 6 years ago

@tinajs/tina-modal v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

tina-modal

:speech_balloon: Modal plugin for Tina.js

npm license PRs Welcome

Setup

  1. Download package from npm
# ensure wxio is installed
npm i -save wxio

# install tina-modal
npm i --save @tinajs/tina-modal
  1. Install into Tina
// app.js
import Tina from '@tinajs/tina'
import modal from '@tinajs/tina-modal'

Tina.use(modal)

Usage

// pages/some-page.js
import { Page } from '@tinajs/tina'
Page.define({
  methods: {
    onSubmit () {
      this.$confirm({ content: 'Submit?' })
        .then(() => this.$alert({ content: 'Confirmed!' }), () => { /* ignore the cancel error */ })
    }
  },
})

API

Page and Component Injections

$alert(options)

  • Arguments:
    • {Object} options
  • Returns: Promise
  • Details:

    Based on wx.showModal.

$confirm(options)

  • Arguments:
    • {Object} options
  • Returns: Promise
  • Details:

    Based on wx.showModal, but the cancel action will reject the promise with a ErrorCancel.

License

MIT @ yelo

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago