菜的像徐坤
排名
7
文章
192
粉丝
15
评论
16
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2025TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术

uniapp APP开发基础

4239人阅读 2021/5/21 11:54 总访问:960952 评论:0 收藏:0 手机
分类: uniapp

前言

uniapp是基于vue.js实现的,代码实现方法不能用jQuery的思路去解决问题,

基本使用

template: 模板
view: 视图,使用时把view当成HTML里的div就行

  1. <template>
  2.     <view class="container">
  3. <view class="title">TNBLOG_APP
  4. <view class="sub-title">
  5.    您的生活好帮手
  6. </view>
  7.         </view>
  8.     </view>
  9. </template>

页面传参数事件

v-on:click :单击事件
nui.navigateTo:页面跳转
onLoad:页面加载时运行

  1. <view class="logn-btn">
  2.         //绑定登陆事件 v-on:click="logen" 等价于@click="login"
  3. <button @click="login">登录</button>
  4. </view>
  5. <script>
  6. export default {
  7. data() {
  8. return {
  9. username:"",
  10. pwd:""
  11. }
  12. },
  13. methods: {
  14.     //logen为方法名
  15. login:function(){
  16. //页面跳转
  17. uni.navigateTo({
  18.         //指向的url
  19. url:'../User/User?username='+userName+'&pwd'+pwd
  20. })
  21. });
  22. }
  23. }
  24. }
  25. </script>
  26. //接收页面,在加载事件中获取值
  27.             onLoad(option){
  28. username = option.username
  29. pwd = option.pwd
  30. }


评价