CocosCreator项目学习系列<二>关于Button(添加事件)输入控制交互条件的触发_实现虚拟按钮控制_JavaScript

CocosCreator项目学习系列<二>关于Button(添加事件)输入控制交互条件的触发_实现虚拟按钮控制_JavaScript<10/12/2017>

<一>.先看实现效果:


此处为补充版本效果,输入控制滑动触发效果:<25/12/2017>额外补充


<二>.界面搭建:(就一个player脚本绑在player身上,下面那些都是按钮的普通和高亮图标)


<三>.上脚本代码:(另外一个脚本忽略,暂时还用不到)

注意点:self=this;(.js语法相关)

关注添加Button事件的API方法

cc.Class({
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
<template> <div> <form @submit.prevent="saveStore"> <div> <label for="platformName">平台名称:</label> <input type="text" id="platformName" v-model="store.platformName" required> <button @click="showNewForm">新增平台</button> <New v-if="showNew" @close="hideNewForm" @save="saveNewPlatform" /> <router-view></router-view> </div> <div> <label for="storeCode">门店编号:</label> <input type="text" id="storeCode" v-model="store.storeCode" required> </div> <div> <label for="authorizationCode">授权编号:</label> <input type="text" id="authorizationCode" v-model="store.authorizationCode" required> </div> <div> <label for="authorizationKey">授权密钥:</label> <input type="text" id="authorizationKey" v-model="store.authorizationKey" required> </div> <div> <label for="memberPrice">会员价开关:</label> <el-switch id="memberPrice" v-model="memberPrice" /> </div> <div> <label for="specialPrice">特价开关:</label> <el-switch id="specialPrice" v-model="specialPrice" /> </div> <div> <label for="unitConversion">单位转换开关:</label> <el-switch id="unitConversion" v-model="unitConversion" /> </div> <div> <button type="submit">{{ isEditing ? '更新门店' : '提交' }}</button> </div> </form> </div> </template> <script> import { createRouter, createWebHistory } from 'vue-router'; import { ref } from 'vue' import New from './New.vue' export default { components: { New, }, data() { return { showNew: false, store: { platformName: '', storeCode: '', authorizationCode: '', authorizationKey: '', memberPrice: false, specialPrice: false, unitConversion: false, }, isEditing: false, }; }, methods: { showNewForm() { this.showNew = true; }, hideNewForm() { this.showNew = false; }, saveNewPlatform(platform) { // TODO: 处理保存平台数据的逻辑 console.log(platform); }, saveStore() { // 添加/编辑门店的逻辑 if (this.isEditing) { // 编辑门店 // ... } else { // 添加门店 // ... } }, addPlatform() { // 新增平台的逻辑 // ... }, }, }; </script>为什么这里面的switch要在输入输入内容才能触发,直接点击不能转换
07-23

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值