ソースを参照

chore(swiper): use icons-vue component (#1937)

* chore(swiper): use icon-vue component

* chore(swiper): update demo in mobile-taro
gyt95 3 年 前
コミット
08121f5589

+ 5 - 4
src/packages/__VUE/swiper/demo.vue

@@ -61,10 +61,10 @@
       </nut-swiper>
       </nut-swiper>
       <view class="nut-swiper-btns">
       <view class="nut-swiper-btns">
         <span class="nut-swiper-btns__left" @click="handlePrev">
         <span class="nut-swiper-btns__left" @click="handlePrev">
-          <nut-icon name="left"></nut-icon>
+          <Left></Left>
         </span>
         </span>
         <span class="nut-swiper-btns__left" @click="handleNext">
         <span class="nut-swiper-btns__left" @click="handleNext">
-          <nut-icon name="right"></nut-icon>
+          <Right></Right>
         </span>
         </span>
       </view>
       </view>
     </view>
     </view>
@@ -115,6 +115,7 @@ import { reactive, toRefs, onMounted, ref, Ref } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
 const { createDemo, translate } = createComponent('swiper');
 const { createDemo, translate } = createComponent('swiper');
 import { useTranslate } from '@/sites/assets/util/useTranslate';
 import { useTranslate } from '@/sites/assets/util/useTranslate';
+import { Left, Right } from '@nutui/icons-vue';
 const initTranslate = () =>
 const initTranslate = () =>
   useTranslate({
   useTranslate({
     'zh-CN': {
     'zh-CN': {
@@ -180,7 +181,6 @@ export default createDemo({
     const handleNext = () => {
     const handleNext = () => {
       swiper.value.next();
       swiper.value.next();
     };
     };
-
     onMounted(() => {
     onMounted(() => {
       setTimeout(() => {
       setTimeout(() => {
         state.list1 = state.list.slice();
         state.list1 = state.list.slice();
@@ -196,7 +196,8 @@ export default createDemo({
       handleNext,
       handleNext,
       translate
       translate
     };
     };
-  }
+  },
+  components: { Left, Right }
 });
 });
 </script>
 </script>
 
 

+ 7 - 3
src/packages/__VUE/swiper/doc.en-US.md

@@ -283,7 +283,7 @@ You can manually switch through `api` (`prev`, `next`)
 
 
 :::demo
 :::demo
 
 
-```html
+```vue
 <template>
 <template>
   <view class="demo-box">
   <view class="demo-box">
     <nut-swiper :init-page="page" :loop="true" ref="swiper">
     <nut-swiper :init-page="page" :loop="true" ref="swiper">
@@ -293,10 +293,10 @@ You can manually switch through `api` (`prev`, `next`)
     </nut-swiper>
     </nut-swiper>
     <view class="nut-swiper-btns">
     <view class="nut-swiper-btns">
       <span class="nut-swiper-btns__left" @click="handlePrev">
       <span class="nut-swiper-btns__left" @click="handlePrev">
-        <nut-icon name='left'></nut-icon>
+        <Left></Left>
       </span>
       </span>
       <span class="nut-swiper-btns__left" @click="handleNext">
       <span class="nut-swiper-btns__left" @click="handleNext">
-        <nut-icon name='right'></nut-icon>
+        <Right></Right>
       </span>
       </span>
     </view>
     </view>
   </view>
   </view>
@@ -304,6 +304,10 @@ You can manually switch through `api` (`prev`, `next`)
 <script lang="ts">
 <script lang="ts">
   import { reactive, toRefs, ref, Ref } from 'vue';
   import { reactive, toRefs, ref, Ref } from 'vue';
   export default {
   export default {
+    components: { 
+      Left, 
+      Right 
+    },
     setup() {
     setup() {
       const swiper = ref(null) as Ref;
       const swiper = ref(null) as Ref;
       const state = reactive({
       const state = reactive({

+ 8 - 3
src/packages/__VUE/swiper/doc.md

@@ -283,7 +283,7 @@ app.use(SwiperItem);
 
 
 :::demo
 :::demo
 
 
-```html
+```vue
 <template>
 <template>
   <view class="demo-box">
   <view class="demo-box">
     <nut-swiper :init-page="page" :loop="true" ref="swiper">
     <nut-swiper :init-page="page" :loop="true" ref="swiper">
@@ -293,17 +293,22 @@ app.use(SwiperItem);
     </nut-swiper>
     </nut-swiper>
     <view class="nut-swiper-btns">
     <view class="nut-swiper-btns">
       <span class="nut-swiper-btns__left" @click="handlePrev">
       <span class="nut-swiper-btns__left" @click="handlePrev">
-        <nut-icon name='left'></nut-icon>
+        <Left></Left>
       </span>
       </span>
       <span class="nut-swiper-btns__left" @click="handleNext">
       <span class="nut-swiper-btns__left" @click="handleNext">
-        <nut-icon name='right'></nut-icon>
+        <Right></Right>
       </span>
       </span>
     </view>
     </view>
   </view>
   </view>
 </template>
 </template>
 <script lang="ts">
 <script lang="ts">
   import { reactive, toRefs, ref, Ref } from 'vue';
   import { reactive, toRefs, ref, Ref } from 'vue';
+  import { Left, Right } from '@nutui/icons-vue';
   export default {
   export default {
+    components: { 
+      Left, 
+      Right 
+    },
     setup() {
     setup() {
       const swiper = ref(null) as Ref;
       const swiper = ref(null) as Ref;
       const state = reactive({
       const state = reactive({

+ 5 - 3
src/sites/mobile-taro/vue/src/exhibition/pages/swiper/index.vue

@@ -63,10 +63,10 @@
       </nut-swiper>
       </nut-swiper>
       <view class="nut-swiper-btns">
       <view class="nut-swiper-btns">
         <span class="nut-swiper-btns__left" @click="handlePrev">
         <span class="nut-swiper-btns__left" @click="handlePrev">
-          <nut-icon name="left"></nut-icon>
+          <Left></Left>
         </span>
         </span>
         <span class="nut-swiper-btns__left" @click="handleNext">
         <span class="nut-swiper-btns__left" @click="handleNext">
-          <nut-icon name="right"></nut-icon>
+          <Right></Right>
         </span>
         </span>
       </view>
       </view>
     </view>
     </view>
@@ -114,6 +114,7 @@
 
 
 <script lang="ts">
 <script lang="ts">
 import { reactive, toRefs, onMounted, ref, Ref } from 'vue';
 import { reactive, toRefs, onMounted, ref, Ref } from 'vue';
+import { Left, Right } from '@nutui/icons-vue';
 
 
 export default {
 export default {
   props: {},
   props: {},
@@ -166,7 +167,8 @@ export default {
       handlePrev,
       handlePrev,
       handleNext
       handleNext
     };
     };
-  }
+  },
+  components: { Left, Right }
 };
 };
 </script>
 </script>