Top-Down and Botton-up

本文探讨了面向服务架构(SOA)与业务流程管理(BPM)的不同实施方式。SOA采用自下而上的方法,主要由IT驱动,通过将现有JavaBean包装为WebService来实现资源重用。BPM则采取自上而下的方法,从业务角度出发进行全新设计,包括WSDL在内的所有组件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

different perspectives SOA, the bottom-up approach, which is primarily IT driven.也即把现有的Java bean包装重用成Web Service等。

 

 And BPM, the top-down approach, which is business driven,一切从头开始设计,包括WSDL等。 

 

我喜欢这么一句话:

从技术(technique)的角度来说,用bottom up approach

从业务(business)的角度来说,用Top down approach

拖拽边框让宽高同时改变,右、右下边框功能一致,左、左下边框功能一致。优化下面代码 package com.maiyou.maiysdk.util.window.draggable; import android.view.MotionEvent; import android.view.View; import com.maiyou.maiysdk.util.DeviceUtil; import com.maiyou.maiysdk.util.DisplayUtil; import com.maiyou.maiysdk.util.ResourceUtil; import com.maiyou.maiysdk.util.window.EasyWindow; public class ResizeDraggable extends BaseDraggable { private static int MIN_SIZE = 0; // 最小尺寸(px) private static int MAX_SIZE = 0; // 最大尺寸(px) private int mInitialWidth; private int mInitialHeight; private int mInitialX; private int mInitialY; private int mFixedCornerX; // 固定角点X坐标 private int mFixedCornerY; // 固定角点Y坐标 private boolean isResizing = false; private int mCornerType; // 当前操作的角落类型 // 角落类型常量 private static final int CORNER_TOP_LEFT = 1; private static final int CORNER_TOP_RIGHT = 2; private static final int CORNER_BOTTOM_LEFT = 3; private static final int CORNER_BOTTOM_RIGHT = 4; @Override public boolean isTouchMoving() { return isResizing; } @Override public void start(EasyWindow<?> easyWindow) { super.start(easyWindow); // 移除宽高比约束,允许自由调整 MIN_SIZE = DisplayUtil.dip2px(easyWindow.getContext(),150); MAX_SIZE = DisplayUtil.dip2px(easyWindow.getContext(),300); } @Override public boolean onTouch(View v, MotionEvent event) { int id = v.getId(); int drag_left = ResourceUtil.getId(v.getContext(), "drag_left"); int drag_right = ResourceUtil.getId(v.getContext(), "drag_right"); int drag_bottom_left = ResourceUtil.getId(v.getContext(), "drag_bottom_left"); int drag_bottom_right = ResourceUtil.getId(v.getContext(), "drag_bottom_right"); if (id == drag_left || id == drag_right || id == drag_bottom_left || id == drag_bottom_right) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mInitialWidth = getViewWidth(); mInitialHeight = getViewHeight(); mInitialX = getViewOnScreenX(); mInitialY = getViewOnScreenY(); isResizing = false; // 确定操作角落类型并设置固定点 if (id == drag_left || id == drag_bottom_left) { mCornerType = CORNER_BOTTOM_LEFT; mFixedCornerX = mInitialX + mInitialWidth; // 固定右上角X mFixedCornerY = mInitialY; // 固定右上角Y } else if (id == drag_right || id == drag_bottom_right) { mCornerType = CORNER_BOTTOM_RIGHT; mFixedCornerX = mInitialX; // 固定左上角X mFixedCornerY = mInitialY; // 固定左上角Y } break; case MotionEvent.ACTION_MOVE: float currentX = event.getRawX(); float currentY = event.getRawY(); int newWidth = mInitialWidth; int newHeight = mInitialHeight; int newX = mInitialX; int newY = mInitialY; // 根据角落类型计算新尺寸和位置 switch (mCornerType) { case CORNER_BOTTOM_LEFT: // 左下角 newWidth = (int) (mFixedCornerX - currentX); newHeight = (int) (currentY - mFixedCornerY); newX = (int) currentX; break; case CORNER_BOTTOM_RIGHT: // 右下角 newWidth = (int) (currentX - mFixedCornerX); newHeight = (int) (currentY - mFixedCornerY); break; } // 应用尺寸限制并保持最小尺寸 newWidth = Math.max(MIN_SIZE, Math.min(newWidth, MAX_SIZE)); newHeight = Math.max(MIN_SIZE, Math.min(newHeight, MAX_SIZE)); // 根据限制后的尺寸调整位置(保持固定点不变) switch (mCornerType) { case CORNER_TOP_LEFT: newX = mFixedCornerX - newWidth; newY = mFixedCornerY - newHeight; break; case CORNER_TOP_RIGHT: newY = mFixedCornerY - newHeight; break; case CORNER_BOTTOM_LEFT: newX = mFixedCornerX - newWidth; break; } // 边界保护:确保窗口不会超出屏幕 int screenWidth = DisplayUtil.getScreenWidth(v.getContext()); int screenHeight = DisplayUtil.getScreenHeight(v.getContext()); newX = Math.max(0, Math.min(newX, screenWidth - newWidth)); newY = Math.max(0, Math.min(newY, screenHeight - newHeight)); // 更新窗口尺寸和位置 getEasyWindow().setWidth(newWidth); getEasyWindow().setHeight(newHeight); updateLocation(newX, newY); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: // refreshLocationCoordinate(); break; } return true; } return false; } } <?xml version="1.0" encoding="utf-8"?><!-- 使用FrameLayout作为根容器便于拖拽区域定位 --> <!-- 内容区域 --> <LinearLayout android:id="@+id/content_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="4dp"> <RelativeLayout android:layout_width="match_parent" android:layout_height="40dp" android:paddingBottom="10dp"> <LinearLayout android:id="@+id/ll_draggable" android:layout_width="30dp" android:layout_height="30dp" android:layout_centerVertical="true" android:gravity="center"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:src="@mipmap/ml_chat_draggable" /> </LinearLayout> <TextView android:layout_width="match_parent" android:layout_height="3dp" android:layout_centerInParent="true" android:layout_marginHorizontal="100dp" android:background="@drawable/botton_yuan_ef_5" /> <LinearLayout android:id="@+id/ll_close" android:layout_width="30dp" android:layout_height="30dp" android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:gravity="center"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:src="@mipmap/ml_bjlb_close" /> </LinearLayout> </RelativeLayout> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rlv_messagr" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:scrollbars="none" /> <TextView android:layout_width="match_parent" android:layout_height="40dp" android:background="@drawable/bg_redius_transparent_75" android:gravity="center_vertical" android:paddingHorizontal="15dp" android:text="说点什么吧" android:textColorHint="@color/milu_color_99" /> </LinearLayout> <!-- 仅占位,形成框 --> <View android:id="@+id/drag_top" android:layout_width="match_parent" android:layout_height="4dp" android:layout_gravity="top" android:background="@color/milu_orange" android:visibility="gone" /> <!-- 拖拽区域 - 左边框 --> <View android:id="@+id/drag_left" android:layout_width="4dp" android:layout_height="wrap_content" android:layout_gravity="top|start" android:background="@color/milu_orange" android:visibility="gone" /> <!-- 拖拽区域 - 右边框 --> <View android:id="@+id/drag_right" android:layout_width="4dp" android:layout_height="wrap_content" android:layout_gravity="top|end" android:background="@color/milu_orange" android:visibility="gone" /> <!-- 拖拽区域 ---> <LinearLayout android:id="@+id/ll_bottom" android:layout_width="wrap_content" android:layout_height="4dp" android:visibility="gone" android:layout_gravity="bottom" android:orientation="horizontal"> <!-- 拖拽区域 - 下左边框 --> <View android:id="@+id/drag_bottom_left" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@color/milu_orange" android:visibility="visible" /> <!-- 拖拽区域 - 下右边框 --> <View android:id="@+id/drag_bottom_right" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="@color/milu_orange" android:visibility="visible" /> </LinearLayout> </FrameLayout>
最新发布
07-03
<think>好的,我现在需要回答用户关于Vue Element UI中el-button组件的使用方法或文档的问题。首先,我得回忆一下Element UI的文档结构和el-button的常见用法。用户可能想了解如何在Vue项目中引入和使用el-button,包括基本用法、属性设置、事件处理等。 首先,我应该检查用户提供的引用内容。引用[1]提到了Vue中button与el-button的禁用属性,引用[2]是关于button组件的源码分析,而引用[3]涉及el-input和el-tree的组合使用。这些引用可能包含用户需要的信息,尤其是禁用属性的设置和组件的基本结构。 接下来,我需要整理el-button的基本使用方法。记得Element UI的组件需要先安装并引入,所以第一步应该是安装步骤。然后,用户可能想知道如何在模板中使用el-button,如何绑定点击事件,以及如何设置不同的属性如type、size、disabled等。 此外,引用[1]中的代码示例显示了一个Vue组件的数据属性dis,并将其绑定到按钮的禁用状态。这说明用户可能对动态控制按钮状态感兴趣,比如通过数据驱动来启用或禁用按钮。这里需要详细说明如何通过v-bind或简写的:disabled来绑定数据。 另外,引用[2]提到button组件的源码,可能涉及到更多高级用法,比如按钮组、图标按钮、加载状态等。用户可能也需要了解这些特性,所以应该涵盖这些内容,并给出示例代码。 还需要考虑样式定制,比如如何修改按钮的样式,引用[3]中的样式类可能对用户有帮助,可以建议用户通过自定义CSS类或覆盖Element UI的默认样式来调整按钮外观。 最后,用户可能需要常见问题的解答,比如按钮点击事件不触发、样式不生效等,这时候需要给出排查步骤,比如检查事件绑定是否正确、样式是否被覆盖等。 总结下来,回答的结构应该是:安装引入、基本用法、属性说明、事件处理、禁用状态、高级用法(图标、加载、按钮组)、样式定制、常见问题。每个部分都需要简洁的示例代码,并引用提供的参考资料中的相关内容,比如禁用属性部分引用[1],源码部分引用[2],样式部分引用[3]。 现在需要确保所有代码示例符合Vue和Element UI的语法,比如使用正确的组件名称和属性。同时,要使用中文回答,保持结构清晰,分点说明,帮助用户一步步理解和应用el-button组件。</think>### Vue Element UI el-button 使用方法 #### 1. **安装与引入** 首先确保已安装 Element UI: ```bash npm install element-ui -S ``` 在 Vue 项目中全局引入: ```javascript import Vue from 'vue'; import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; Vue.use(ElementUI); ``` #### 2. **基础用法** 在模板中直接使用 `el-button` 组件: ```html <el-button type="primary">主要按钮</el-button> <el-button type="success">成功按钮</el-button> <el-button @click="handleClick">点击事件</el-button> ``` 通过 `type` 属性设置按钮样式(如 `primary`、`success`、`warning` 等)[^2]。 #### 3. **禁用按钮** 通过 `disabled` 属性控制按钮状态,支持动态绑定: ```html <el-button :disabled="dis">禁用按钮</el-button> ``` 在 Vue 的 `data` 中定义 `dis` 变量: ```javascript data() { return { dis: true // 初始为禁用状态 }; } ``` 动态切换时可通过方法修改 `dis` 的值[^1]。 #### 4. **高级功能** - **图标按钮**: 使用 `icon` 属性添加图标: ```html <el-button icon="el-icon-search">搜索</el-button> ``` - **加载状态**: 通过 `loading` 属性实现加载效果: ```html <el-button type="primary" :loading="isLoading">提交中</el-button> ``` - **按钮组**: 使用 `el-button-group` 包裹多个按钮: ```html <el-button-group> <el-button type="primary">上一页</el-button> <el-button type="primary">下一页</el-button> </el-button-group> ``` #### 5. **样式与尺寸** - **自定义样式**: 通过 `class` 或内联样式覆盖默认样式,例如引用[^3]中的 `.selectTree-input`。 ```html <el-button class="custom-button">自定义按钮</el-button> ``` - **调整尺寸**: 使用 `size` 属性(如 `medium`、`small`、`mini`): ```html <el-button size="small">小型按钮</el-button> ``` #### 6. **常见问题** - **点击事件不触发**: 检查是否漏写 `@click` 或方法未在 `methods` 中定义。 - **禁用状态无效**: 确保 `disabled` 属性绑定正确,如 `:disabled="dis"` 而非 `disabled="dis"`。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值