@tinajs/tina-modal

0.2.0 • Public • Published

tina-modal

💬 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

Readme

Keywords

none

Package Sidebar

Install

npm i @tinajs/tina-modal

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • malash
  • jimexist
  • yelo