c-actionsheet


操作列表

示例

  1. <template>
  2. <page title="c-actionsheet演示">
  3. <button class="btn" c-bind:onclick="showActionSheet" text="ActionSheet"></button>
  4. <button class="btn" c-bind:onclick="showActionSheetActive" text="ActionSheet - active"></button>
  5. <button class="btn" c-bind:onclick="showActionSheetPicker" text="ActionSheet - pickerStyle"></button>
  6. <c-actionsheet
  7. show="{{actionShow}}"
  8. title="{{title}}"
  9. list="{{list}}"
  10. active="{{active}}"
  11. cancel-txt="取消"
  12. picker-style="{{pickerStyle}}"
  13. c-bind:cancel="cancel"
  14. c-bind:select="select"
  15. ></c-actionsheet>
  16. </page>
  17. </template>
  18. <script>
  19. import cml from 'chameleon-api';
  20. class CActionsheet {
  21. data = {
  22. actionShow: false,
  23. mask: true,
  24. list: ["高铁", "火车", "飞机", "打车", "地铁"],
  25. active: -1,
  26. title: "出行方式",
  27. pickerStyle: false
  28. }
  29. methods = {
  30. showActionSheet() {
  31. this.pickerStyle = false;
  32. this.actionShow = true;
  33. },
  34. showActionSheetActive() {
  35. this.pickerStyle = false;
  36. this.actionShow = true;
  37. },
  38. showActionSheetPicker() {
  39. this.pickerStyle = true;
  40. this.actionShow = true;
  41. },
  42. cancel() {
  43. this.actionShow = false;
  44. cml.showToast({
  45. message: "Clicked 取消"
  46. });
  47. },
  48. select(e) {
  49. this.actionShow = false;
  50. this.active = +e.detail.index;
  51. cml.showToast({
  52. message: "Clicked" + " " + e.detail.value
  53. });
  54. }
  55. }
  56. }
  57. export default new CActionsheet();
  58. </script>
  59. <style scoped>
  60. .btn {
  61. margin-top: 20cpx;
  62. align-self: center;
  63. }
  64. </style>
  65. <script cml-type="json">
  66. {
  67. "base": {
  68. "usingComponents": {
  69. "c-actionsheet": "cml-ui/components/c-actionsheet/c-actionsheet"
  70. }
  71. }
  72. }
  73. </script>