123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <template>
- <view>
- <view class="speech-bubble" :class="direction">
- <text>{{msg}}</text>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "bubble-tip",
- props: {
- msg: {
- type: String
- }
- },
- data() {
- return {
- direction: "speech-bubble-bottom"
- };
- }
- }
- </script>
- <style scoped>
- .speech-bubble {
- position: relative;
- background-color: #292929;
- width: max-content;
- min-width: 100rpx;
- /* 垂直居中 */
- color: white;
- text-align: center;
- border-radius: 10px;
- padding: 10rpx 10rpx 10rpx 10rpx;
- }
- .speech-bubble:after {
- content: '';
- position: absolute;
- width: 0;
- height: 0;
- border: 15rpx solid;
- }
- .speech-bubble-bottom:after {
- border-top-color: #292929;
- top: 100%;
- left: 50%;
- margin-left: -15rpx;
- }
- </style>
|