Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
639 views
in Technique[技术] by (71.8m points)

微信小程序使用vant框架折叠效果,死活不出来,求助

小程序使用vant框架,在做一个折叠效果。按照官方给出的示例,死活不出来折叠效果。

首先在index.json中引入折叠组件

        "van-collapse": "vant-weapp/collapse/index",
        "van-collapse-item": "vant-weapp/collapse-item/index"

接着在index.wxml中写出折叠内容的主体
`<van-collapse v-model="activeNames">
<van-collapse-item title="标题1" name="1">内容</van-collapse-item>
<van-collapse-item title="标题2" name="2">内容</van-collapse-item>
<van-collapse-item title="标题3" name="3" disabled>内容</van-collapse-item>
</van-collapse>`

最后在index.js

Page({

  /**
   * 页面的初始数据
   */
  data: {
    activeNames: ['1']
  },
  ......

请问我哪里写错了吗?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

看错文档了吧。
vant 这个 UI 组件库分为小程序端 vant-weapp 和以 vue 为基础框架的移动端 vant
小程序端 vant 是没有用 v-model 进行双向数据绑定的,这个是 vue 里面的。
小程序端 collapse 组件地址 https://youzan.github.io/vant-weapp/#/collapse
你应该是用了这里面的例子吧 https://youzan.github.io/vant/#/zh-CN/collapse


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...