Skip to content

Commit

Permalink
chore: ellipse
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Nov 9, 2023
1 parent e46815e commit 6ee1d71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
13 changes: 2 additions & 11 deletions src/packages/__VUE/ellipsis/index.taro.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<view>
<view :id="'root' + refRandomId" ref="root" :class="classes" @click="handleClick">
<view :id="'root' + refRandomId" ref="root" class="nut-ellipsis ell" @click="handleClick">
<view v-if="!exceeded" class="nut-ellipsis__wordbreak">{{ content }}</view>

<view v-if="exceeded && !expanded" class="nut-ellipsis__wordbreak">
Expand Down Expand Up @@ -32,7 +32,7 @@ import { ref, reactive, toRefs, computed, onMounted, PropType, unref } from 'vue
import { createComponent } from '@/packages/utils/create';
import { useTaroRect } from '@/packages/utils/useTaroRect';
import Taro from '@tarojs/taro';
const { componentName, create } = createComponent('ellipsis');
const { create } = createComponent('ellipsis');
export type Direction = 'start' | 'end' | 'middle';
type EllipsisedValue = {
Expand Down Expand Up @@ -96,14 +96,6 @@ export default create({
const letterUpperReg = /^[A-Z]+$/; //字母
const letterLowerReg = /^[a-z]+$/; //字母
const classes = computed(() => {
const prefixCls = componentName;
return {
ell: true,
[prefixCls]: true
};
});
const symbolText = computed(() => {
if (props.direction == 'end' || props.direction == 'middle') {
return `${props.symbol}${props.expandText}`;
Expand Down Expand Up @@ -299,7 +291,6 @@ export default create({
rootContain,
symbolContain,
ellipsis,
classes,
contantCopy,
symbolText,
clickHandle,
Expand Down
15 changes: 4 additions & 11 deletions src/packages/__VUE/ellipsis/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<view ref="root" :class="classes" @click="handleClick">
<view ref="root" class="nut-ellipsis" @click="handleClick">
<view v-if="!exceeded">{{ content }}</view>
<view v-if="exceeded && !expanded"
>{{ ellipsis && ellipsis.leading
Expand All @@ -13,9 +13,9 @@
</view>
</template>
<script lang="ts">
import { ref, reactive, toRefs, computed, onMounted, PropType, watch } from 'vue';
import { ref, reactive, toRefs, onMounted, PropType, watch } from 'vue';
import { createComponent } from '@/packages/utils/create';
const { componentName, create } = createComponent('ellipsis');
const { create } = createComponent('ellipsis');
export type Direction = 'start' | 'end' | 'middle';
type EllipsisedValue = {
Expand Down Expand Up @@ -66,13 +66,6 @@ export default create({
expanded: false //是否折叠
});
const classes = computed(() => {
const prefixCls = componentName;
return {
[prefixCls]: true
};
});
watch(
() => props.content,
(newV, oldVal) => {
Expand Down Expand Up @@ -225,7 +218,7 @@ export default create({
emit('click');
};
return { ...toRefs(state), root, ellipsis, classes, clickHandle, handleClick };
return { ...toRefs(state), root, ellipsis, clickHandle, handleClick };
}
});
</script>

0 comments on commit 6ee1d71

Please sign in to comment.