Skip to content

Latest commit

 

History

History

wxc-dialog

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

wxc-dialog

Use to show important information for the system, and ask for user feedback. eg: When deleting an important content, pop up a Modal for secondary confirmation.

Rule

  • Use as few as possible. Modal will interrupt user operation, only use it at important situation.
  • Title should be concise, do not exceed 1 line; description should be concise and complete, generally no more than 2 lines.
  • Generally put the most likely clicked button on the right side. In addition, the cancel button should always be on the left.

    

Code Example

<template>
  <div class="container">
    <div class="demo">
      <div class="btn" @click="openDialog">
        <text class="btn-txt">Dialog</text>
      </div>
    </div>
    <wxc-dialog title="title"
                content="this is content"
                :show="show"
                :single="false"
                :is-checked="isChecked"
                :show-no-prompt="true"
                @wxcDialogCancelBtnClicked="wxcDialogCancelBtnClicked"
                @wxcDialogConfirmBtnClicked="wxcDialogConfirmBtnClicked"
                @wxcDialogNoPromptClicked="wxcDialogNoPromptClicked">
    </wxc-dialog>
  </div>
</template>

<script>
  import { WxcDialog } from 'weex-ui';
  export default {
    components: { WxcDialog },
    data: function () {
      return {
        show: false,
        isChecked: false
      };
    },
    methods: {
      openDialog () {
        this.show = true;
      },
      wxcDialogCancelBtnClicked () {
      // must setting,control by yourself
        this.show = false;
      },
      wxcDialogConfirmBtnClicked () {
      // must setting,control by yourself
        this.show = false;
      },
      wxcDialogNoPromptClicked (e) {
      // must setting,control by yourself
        this.isChecked = e.isChecked;
      }
    }
  };
</script>

More details can be found in here

API

Prop Type Required Default Description
title String Y - title (only transparent)
content String N - content
top Number N 400 distance from the top of the screen
single Boolean N false whether is single button
confirm-text String N 确定 text of the primary button
cancel-text String N 取消 text of the secondary button
main-btn-color String N #EE9900 color of the primary button
second-btn-color String N #666666 color of the secondary button
show-no-prompt Boolean N false whether to show no-prompt
no-prompt-text String N 不再提示 text of the no-prompt
is-checked Boolean N false checked of the no-prompt

Event

@wxcDialogCancelBtnClicked="wxcDialogCancelBtnClicked"、
@wxcDialogConfirmBtnClicked="wxcDialogConfirmBtnClicked"、
@wxcDialogNoPromptClicked="wxcDialogNoPromptClicked"

Slot

  1. <slot name="title"></slot>
  2. <slot name="content"></slot>