2020-10-17 15:49:02 +00:00
< template >
< div class = "_card" >
< div class = "_content" >
2022-12-17 22:32:25 +00:00
< FormInput v-model = "text" >
2021-08-06 13:29:19 +00:00
< template # label > Text < / template >
2022-12-17 22:32:25 +00:00
< / FormInput >
< FormSwitch v-model = "flag" >
2020-10-17 15:49:02 +00:00
< span > Switch is now { { flag ? 'on' : 'off' } } < / span >
2022-12-17 22:32:25 +00:00
< / FormSwitch >
2020-10-17 15:49:02 +00:00
< div style = "margin: 32px 0;" >
2022-12-17 22:32:25 +00:00
< FormRadio v-model = "radio" value="misskey" > Misskey < / FormRadio >
< FormRadio v-model = "radio" value="mastodon" > Mastodon < / FormRadio >
< FormRadio v-model = "radio" value="pleroma" > Pleroma < / FormRadio >
2020-10-17 15:49:02 +00:00
< / div >
< MkButton inline > This is < / MkButton >
< MkButton inline primary > the button < / MkButton >
< / div >
2021-01-09 08:18:45 +00:00
< div class = "_content" style = "pointer-events: none;" >
2020-10-17 15:49:02 +00: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 >
2022-07-29 16:46:58 +00:00
< script lang = "ts" setup >
import { ref } from 'vue' ;
2021-11-11 17:02:25 +00:00
import MkButton from '@/components/ui/button.vue' ;
2022-12-17 22:32:25 +00:00
import FormInput from '@/components/form/input.vue' ;
import FormSwitch from '@/components/form/switch.vue' ;
import FormRadio from '@/components/form/radio.vue' ;
2021-11-11 17:02:25 +00:00
import * as os from '@/os' ;
import * as config from '@/config' ;
2022-07-29 16:46:58 +00:00
import { $i } from '@/account' ;
2020-10-17 15:49:02 +00:00
2022-07-29 16:46:58 +00:00
const text = ref ( '' ) ;
const flag = ref ( true ) ;
const radio = ref ( 'misskey' ) ;
const mfm = ref ( ` Hello world! This is an @example mention. BTW you are @ ${ $i ? $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. ` ) ;
2020-10-17 15:49:02 +00:00
2022-07-29 16:46:58 +00:00
function openDialog ( ) : void {
os . alert ( {
type : 'warning' ,
title : 'Oh my Aichan' ,
text : 'Lorem ipsum dolor sit amet, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' ,
} ) ;
}
2020-10-17 15:49:02 +00:00
2022-07-29 16:46:58 +00:00
function openForm ( ) : void {
os . form ( 'Example form' , {
foo : {
type : 'boolean' ,
default : true ,
label : 'This is a boolean property' ,
2020-10-17 15:49:02 +00:00
} ,
2022-07-29 16:46:58 +00:00
bar : {
type : 'number' ,
default : 300 ,
label : 'This is a number property' ,
2020-10-17 15:49:02 +00:00
} ,
2022-07-29 16:46:58 +00:00
baz : {
type : 'string' ,
default : 'Misskey makes you happy.' ,
label : 'This is a string property' ,
2020-10-17 15:49:02 +00:00
} ,
2022-07-29 16:46:58 +00:00
} ) ;
}
2020-10-17 15:49:02 +00:00
2022-07-29 16:46:58 +00:00
function openDrive ( ) : void {
os . selectDriveFile ( true ) ;
}
2020-10-17 15:49:02 +00:00
2022-07-29 16:46:58 +00:00
function openMenu ( ev ) : void {
os . popupMenu ( [ {
type : 'label' ,
2022-08-10 20:42:30 +00:00
text : 'Fruits' ,
2022-07-29 16:46:58 +00:00
} , {
text : 'Create some apples' ,
action : ( ) : void => { } ,
} , {
text : 'Read some oranges' ,
action : ( ) : void => { } ,
} , {
text : 'Update some melons' ,
action : ( ) : void => { } ,
} , null , {
text : 'Delete some bananas' ,
danger : true ,
action : ( ) : void => { } ,
} ] , ev . currentTarget ? ? ev . target ) ;
}
2020-10-17 15:49:02 +00:00
< / script >