提交 34038c66 编写于 作者: Codet's avatar Codet

fix(*): add vote-button

上级 8d41ca55
<template>
<view @click="handleClick">
<slot></slot>
</view>
</template>
<script lang="ts">
import Vue from "vue"
export default Vue.extend({
methods: {
handleClick() {
console.log("触发点击")
},
},
})
</script>
<style scoped></style>
......@@ -36,12 +36,14 @@
class="flex-1 border border-solid border-gray-500 bg-purple-300 text-white p-2"
>{{ item.stats[0].value }}</view
>
<view
class="flex-1 border border-solid border-orange-500 bg-orange-500 text-white p-2"
@click="vote"
>
投票
</view>
<vote-button>
<view
class="flex-1 border border-solid border-orange-500 bg-orange-500 text-white p-2"
@click="vote"
>
投票
</view>
</vote-button>
</view>
</view>
</view>
......@@ -49,7 +51,11 @@
<script lang="ts">
import Vue from "vue"
import voteButton from "@/components/vote-button/vote-button.vue"
export default Vue.extend({
components: {
voteButton,
},
data() {
return {}
},
......
{
"pages": [
{
"path": "pages/home/home",
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "微投票"
}
},
{
"path": "pages/home/home",
"style": {
"navigationBarTitleText": "婉美投票"
}
},
{
"path": "pages/index/index",
"style": {
......
......@@ -135,6 +135,18 @@ export default Vue.extend({
provider: "weixin",
success: infoRes => {
console.log("用户信息为:", infoRes)
//TODO: 传值给后端
uni.showToast({
title: "投票成功!",
icon: "success"
})
},
fail: err => {
console.error("获取用户信息失败", err)
uni.showToast({
title: `获取用户信息失败,没法进行投票哦!`,
icon: "none"
})
}
})
}
......
<template>
$END$
<view>
婉美投票
<button class="" open-type="getUserInfo" @getuserinfo="getuserinfo">
授权使用微信头像、昵称
</button>
</view>
</template>
<script>
export default {
name: "login.vue"
}
</script>
<script lang="ts">
import Vue from "vue"
<style scoped>
export default Vue.extend({
methods: {
getuserinfo() {
uni.authorize({
scope: "scope.userinfo",
success: res => {
console.log("授权成功", res)
}
})
}
},
})
</script>
</style>
\ No newline at end of file
<style scoped></style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册