<template>
  <view class="container">
    农业知识页面（待开发）
    <!-- 使用iframe方式嵌入，仅在H5下有效 -->
    <iframe
      class="dify-iframe"
      src="https://your-dify-server.com/embed/chat?token=xxx"
      frameborder="0"
    ></iframe>
  </view>
</template>

<script>
export default {
  mounted() {
    // 设置配置
    window.difyChatbotConfig = {
      token: 'OFaLSsPTnueswy16',
      baseUrl: 'http://121.4.16.100'
    };

    // 注入脚本
    const script = document.createElement('script');
    script.src = 'http://121.4.16.100/embed.min.js';
    script.id = 'OFaLSsPTnueswy16';
    script.defer = true;
    document.body.appendChild(script);
  }
}
</script>

<style scoped>
.dify-iframe {
  width: 100%;
  height: 100vh;
  border: none;
}
 #dify-chatbot-bubble-button {
    background-color: #1C64F2 !important;
  }
  #dify-chatbot-bubble-window {
    width: 24rem !important;
    height: 40rem !important;
  }
.container {
  padding: 40rpx;
  font-size: 32rpx;
}
</style>