2020-10-17 09:49:02 -06:00
< template >
< div class = "_card" >
< div class = "_content" >
2021-08-06 07:29:19 -06:00
< MkInput v-model = "text" >
< template # label > Text < / template >
2020-10-17 09:49:02 -06:00
< / MkInput >
2021-08-06 07:29:19 -06:00
< MkSwitch v-model = "flag" >
2020-10-17 09:49:02 -06:00
< span > Switch is now { { flag ? 'on' : 'off' } } < / span >
< / MkSwitch >
< div style = "margin: 32px 0;" >
2022-07-18 20:00:45 -06:00
< MkRadio v-model = "radio" value="misskey" > Calckey < / MkRadio >
2020-10-17 09:49:02 -06:00
< MkRadio v-model = "radio" value="mastodon" > Mastodon < / MkRadio >
< MkRadio v-model = "radio" value="pleroma" > Pleroma < / MkRadio >
< / div >
< MkButton inline > This is < / MkButton >
< MkButton inline primary > the button < / MkButton >
< / div >
2021-01-09 01:18:45 -07:00
< div class = "_content" style = "pointer-events: none;" >
2020-10-17 09:49:02 -06:00
< Mfm :text = "mfm" / >
< / div >
< div class = "_content" >
< MkButton inline primary @click ="openMenu" > Open menu < / MkButton >
< MkButton inline primary @click ="openDialog" > Open dialog < / MkButton >
< MkButton inline primary @click ="openForm" > Open form < / MkButton >
< MkButton inline primary @click ="openDrive" > Open drive < / MkButton >
< / div >
< / div >
< / template >
< script lang = "ts" >
import { defineComponent } from 'vue' ;
2022-09-06 03:21:49 -06:00
import MkButton from '@/components/MkButton.vue' ;
2021-11-11 10:02:25 -07:00
import MkInput from '@/components/form/input.vue' ;
import MkSwitch from '@/components/form/switch.vue' ;
import MkTextarea from '@/components/form/textarea.vue' ;
import MkRadio from '@/components/form/radio.vue' ;
import * as os from '@/os' ;
import * as config from '@/config' ;
2020-10-17 09:49:02 -06:00
export default defineComponent ( {
components : {
MkButton ,
MkInput ,
MkSwitch ,
MkTextarea ,
MkRadio ,
} ,
data ( ) {
return {
text : '' ,
2021-01-09 01:18:45 -07:00
flag : true ,
2022-07-19 11:49:43 -06:00
radio : 'calckey' ,
mfm : ` Hello world! This is an @example mention. BTW, you are @ ${ this . $i ? this . $i . username : 'guest' } . \ nAlso, here is ${ config . url } and [example link]( ${ config . url } ). for more details, see https://example.com. \ nAs you know #misskey is open-source software. `
2022-06-09 23:36:55 -06:00
} ;
2020-10-17 09:49:02 -06:00
} ,
methods : {
async openDialog ( ) {
2021-11-18 02:45:58 -07:00
os . alert ( {
2020-10-17 09:49:02 -06:00
type : 'warning' ,
2022-08-08 15:58:27 -06:00
title : 'Oh my Calc' ,
2020-10-17 09:49:02 -06:00
text : 'Lorem ipsum dolor sit amet, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' ,
} ) ;
} ,
async openForm ( ) {
os . form ( 'Example form' , {
foo : {
type : 'boolean' ,
default : true ,
label : 'This is a boolean property'
} ,
bar : {
type : 'number' ,
default : 300 ,
label : 'This is a number property'
} ,
baz : {
type : 'string' ,
2022-07-18 20:00:45 -06:00
default : 'Calckey makes you happy.' ,
2020-10-17 09:49:02 -06:00
label : 'This is a string property'
} ,
} ) ;
} ,
async openDrive ( ) {
os . selectDriveFile ( ) ;
} ,
async selectUser ( ) {
os . selectUser ( ) ;
} ,
async openMenu ( ev ) {
2021-08-07 21:19:10 -06:00
os . popupMenu ( [ {
2020-10-17 09:49:02 -06:00
type : 'label' ,
text : 'Fruits'
} , {
text : 'Create some apples' ,
action : ( ) => { } ,
} , {
text : 'Read some oranges' ,
action : ( ) => { } ,
} , {
text : 'Update some melons' ,
action : ( ) => { } ,
} , null , {
text : 'Delete some bananas' ,
danger : true ,
action : ( ) => { } ,
2022-01-27 19:53:12 -07:00
} ] , ev . currentTarget ? ? ev . target ) ;
2020-10-17 09:49:02 -06:00
} ,
}
} ) ;
< / script >