-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
70 additions
and
190 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
packages/nutui-taro-demo/src/business/pages/barrage/basic.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<div style="position: relative; height: 150px"> | ||
<nut-barrage ref="barrageRef" :danmu="list"></nut-barrage> | ||
</div> | ||
<div class="test"> | ||
<nut-button @click="add">随机添加</nut-button> | ||
</div> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const barrageRef = ref(); | ||
const list = ref(['画美不看', '不明觉厉', '喜大普奔', '男默女泪', '累觉不爱', '爷青结-']); | ||
const add = () => { | ||
const n = Math.random(); | ||
barrageRef.value.add('随机——' + String(n).substr(2, 10)); | ||
}; | ||
</script> |
40 changes: 13 additions & 27 deletions
40
packages/nutui-taro-demo/src/business/pages/barrage/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,20 @@ | ||
<template> | ||
<Demo class="barrage-demo"> | ||
<h2>基础用法</h2> | ||
<nut-cell class="danmu-box"> | ||
<nut-barrage ref="danmu" :danmu="list"></nut-barrage> | ||
</nut-cell> | ||
<div class="test"> | ||
<nut-button class="add nut-button--primary" @click="addDanmu">随机添加</nut-button> | ||
</div> | ||
<Demo> | ||
<h2>{{ t('basic') }}</h2> | ||
<Basic /> | ||
</Demo> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
const danmu = ref<any>(null); | ||
let list = ref(['画美不看', '不明觉厉', '喜大普奔', '男默女泪', '累觉不爱', '爷青结']); | ||
function addDanmu() { | ||
let n = Math.random(); | ||
danmu.value.add('随机——' + String(n).substr(2, 10)); | ||
} | ||
</script> | ||
import { useTranslate } from '../../../utils'; | ||
import Basic from './basic.vue'; | ||
<style lang="scss"> | ||
.barrage-demo { | ||
.danmu-box, | ||
.nut-barrage { | ||
padding: 20px 0; | ||
height: 150px; | ||
} | ||
.nut-button { | ||
width: 100%; | ||
const t = useTranslate({ | ||
'zh-CN': { | ||
basic: '基础用法' | ||
}, | ||
'en-US': { | ||
basic: 'Basic Usage' | ||
} | ||
} | ||
</style> | ||
}); | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<div style="position: relative; height: 150px"> | ||
<nut-barrage ref="barrageRef" :danmu="list"></nut-barrage> | ||
</div> | ||
<div class="test"> | ||
<nut-button @click="add">随机添加</nut-button> | ||
</div> | ||
</template> | ||
<script setup> | ||
import { ref } from 'vue'; | ||
const barrageRef = ref(); | ||
const list = ref(['画美不看', '不明觉厉', '喜大普奔', '男默女泪', '累觉不爱', '爷青结-']); | ||
const add = () => { | ||
const n = Math.random(); | ||
barrageRef.value.add('随机——' + String(n).substr(2, 10)); | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<Demo> | ||
<h2>{{ t('basic') }}</h2> | ||
<Basic /> | ||
</Demo> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useTranslate } from '@/sites/utils'; | ||
import Basic from './basic.vue'; | ||
const t = useTranslate({ | ||
'zh-CN': { | ||
basic: '基础用法' | ||
}, | ||
'en-US': { | ||
basic: 'Basic Usage' | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters