0.1.7 • Published 2 years ago

@moment-design/select-page-dialog v0.1.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ResourceManagement

选择链接组件

运行环境

名称版本号
Node.js15+
NPM7+
Vue.js3+
@moment-design/web-vue1+

API 说明

初始化

参数名描述类型必须默认值
baseUrl业务接口域名() => string-
kshUrl可视化接口域名() => string-
errorCallback云资源请求错误回调(err) => void-
getToken请求 token() => string-

函数调用

参数名描述类型必须默认值
disabled禁用路径PathDetail-
defaultPage默认选中路径PathDetail[]-
confirm回调函数(PathDetail) => void;-
PathDetail说明:
{
    "name": "首页",
    "link": "",
    "key": "home",
    "wxLink": {
        "name": "home",
        "iosPath": "ZDHomeViewController",
        "path": "pages/home/index",
        "isTab": true,
        "meta": {
            "title": "首页"
        },
        "query": {}
    }
}

使用组件

  1. 安装依赖

    npm install @moment-design/select-page-dialog --save
  2. 引用组件

    main.ts中全局引入组件

    import { createApp } from 'vue';
    import app from './App.vue';
    import theLinkManager from '@moment-design/select-page-dialog';
    
    const App = createApp(app);
    App.use(theLinkManager, {
      baseUrl: () => {
        return '';
      },
      kshUrl: () => {
        return '';
      },
      errorCallback: (err) => {
        console.error('=========errorCallback=============', err);
      },
      getToken: () => {
        return '';
      },
    });
  3. 函数调用

    <template>
      <m-space>
        <m-button @click="onShow(1)">点击选择链接</m-button>
        <m-button @click="onShow(2)">显示禁用链接</m-button>
        <m-button @click="onShow(3)">显示默认选择链接</m-button></m-space
      >
    
      <p>{{ link1 }}</p>
    </template>
    
    <script lang="ts" setup>
    import { ref } from '@vue/runtime-core';
    import theLinkManager from '@moment-design/select-page-dialog';
    
    const link1 = ref<any>();
    
    const onShow = (index: number): void => {
      theLinkManager.show({
        defaultPage:
          index === 3
            ? {
                name: '首页',
                link: '',
                key: 'home',
                wxLink: {
                  name: 'home',
                  iosPath: 'ZDHomeViewController',
                  path: 'pages/home/index',
                  isTab: true,
                  meta: { title: '首页' },
                },
              }
            : null,
        disabled:
          index === 2
            ? [
                {
                  name: '我的',
                  link: '',
                  key: 'user-center',
                  wxLink: {
                    name: 'user-center',
                    path: 'pages/user/center/index',
                    iosPath: 'ZDMyViewController',
                    isTab: true,
                    meta: { title: '我的' },
                  },
                },
                {
                  name: '购物车',
                  link: '',
                  key: 'shopping-cart-for-tabbar',
                  wxLink: {
                    name: 'shopping-cart-for-tabbar',
                    path: 'pages/product/shopping-cart-for-tabbar/index',
                    isTab: true,
                    iosPath: 'ZDShopCartViewController',
                    meta: { title: '购物车' },
                  },
                },
              ]
            : [],
        confirm: (res: any) => {
          link1.value = res;
        },
      });
    };
    </script>
0.1.7

2 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago