Awesome
tina-modal
:speech_balloon: Modal plugin for Tina.js
Setup
- Download package from npm
# ensure wxio is installed
npm i -save wxio
# install tina-modal
npm i --save @tinajs/tina-modal
- 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 aErrorCancel
.
License
MIT @ yelo