Browse Source

chore(table): use icons-vue component (#1947)

* fix table 切换icons

* fix 代码撤回

Co-authored-by: shijiaixin <shijiaxin@yanxiu.com>
sjx12 3 years ago
parent
commit
275f53820f

+ 3 - 3
src/packages/__VUE/table/__tests__/index.spec.ts

@@ -1,12 +1,12 @@
 import { mount, config } from '@vue/test-utils';
 import Table from '../index.vue';
 import { nextTick, h } from 'vue';
-import NutIcon from '../../icon/index.vue';
+import { Dongdong } from '@nutui/icons-vue';
 import NutButton from '../../button/index.vue';
 
 beforeAll(() => {
   config.global.components = {
-    NutIcon,
+    Dongdong,
     NutButton
   };
 });
@@ -97,7 +97,7 @@ const data2 = [
     sex: '女',
     record: '本科',
     render: () => {
-      return h(NutIcon, { name: 'dongdong', size: '14px' });
+      return h(Dongdong, { width: '14px', height: '14px' });
     }
   },
   {

+ 3 - 1
src/packages/__VUE/table/common.ts

@@ -1,11 +1,13 @@
 import { computed, PropType, reactive, toRefs, watch } from 'vue';
 import RenderColumn from './renderColumn';
+import { DownArrow } from '@nutui/icons-vue';
 import { TableColumnProps } from './types';
 
 export const component = (componentName: string, translate: Function) => {
   return {
     components: {
-      RenderColumn
+      RenderColumn,
+      DownArrow
     },
     props: {
       bordered: {

+ 3 - 3
src/packages/__VUE/table/demo.vue

@@ -31,7 +31,7 @@ import { createComponent } from '@/packages/utils/create';
 import { TableColumnProps } from './types';
 import { Toast } from '@/packages/nutui.vue';
 import Button from '@/packages/__VUE/button/index.vue';
-import Icon from '@/packages/__VUE/icon/index.vue';
+import { Dongdong } from '@nutui/icons-vue';
 const { createDemo, translate } = createComponent('table');
 import { useTranslate } from '@/sites/assets/util/useTranslate';
 const initTranslate = () =>
@@ -94,7 +94,7 @@ const initTranslate = () =>
 export default createDemo({
   components: {
     Button,
-    Icon
+    Dongdong
   },
   props: {},
   setup(props, { emit, slot }) {
@@ -274,7 +274,7 @@ export default createDemo({
           sex: translate('woman'),
           record: translate('undergraduate'),
           render: () => {
-            return h(Icon, { name: 'dongdong', size: '14px' });
+            return h(Dongdong, { width: '14px', height: '14px' });
           }
         },
         {

+ 3 - 2
src/packages/__VUE/table/doc.en-US.md

@@ -376,7 +376,8 @@ app.use(Table);
 </template>
 <script lang="ts">
   import { reactive, toRefs, h } from 'vue';
-  import { Button, Icon } from '@nutui/nutui';
+  import { Button } from '@nutui/nutui';
+  import { Dongdong } from '@nutui/icons-vue';
   export default {
     setup() {
       const state = reactive({
@@ -423,7 +424,7 @@ app.use(Table);
             sex: 'woman',
             record: 'undergraduate',
             render: () => {
-              return h(Icon, { name: 'dongdong', size: '14px' });
+              return h(Dongdong, {  width: '14px',height:'14px' });
             }
           },
           {

+ 3 - 2
src/packages/__VUE/table/doc.md

@@ -376,7 +376,8 @@ app.use(Table);
 </template>
 <script lang="ts">
   import { reactive, toRefs, h } from 'vue';
-  import { Button, Icon } from '@nutui/nutui';
+  import { Button } from '@nutui/nutui';
+   import { Dongdong } from '@nutui/icons-vue';
   export default {
     setup() {
       const state = reactive({
@@ -423,7 +424,7 @@ app.use(Table);
             sex: '女',
             record: '本科',
             render: () => {
-              return h(Icon, { name: 'dongdong', size: '14px' });
+              return h(Dongdong, {  width: '14px',height:'14px '});
             }
           },
           {

+ 1 - 1
src/packages/__VUE/table/index.taro.vue

@@ -13,7 +13,7 @@
           >
             {{ item.title }}
             <slot name="icon"></slot>
-            <nut-icon v-if="!$slots.icon && item.sorter" name="down-arrow" size="12px"></nut-icon>
+            <DownArrow v-if="!$slots.icon && item.sorter" width="12px" height="12px"></DownArrow>
           </span>
         </view>
       </view>

+ 1 - 1
src/packages/__VUE/table/index.vue

@@ -13,7 +13,7 @@
           >
             {{ item.title }}
             <slot name="icon"></slot>
-            <nut-icon v-if="!$slots.icon && item.sorter" name="down-arrow" size="12px"></nut-icon>
+            <DownArrow v-if="!$slots.icon && item.sorter" width="12px" height="12px"></DownArrow>
           </span>
         </view>
       </view>