1234567891011121314151617181920212223242526272829303132333435363738 |
- // myComponents/bubble/bubble.js
- Component({
- properties: {
- // 气泡框显示时的样式
- showStyle: {
- type: Object,
- value: {}
- }
- },
- data: {
- // 控制气泡框的显示与隐藏
- show: false
- },
- methods: {
- // 显示气泡框
- showBubble() {
- this.setData({
- show: true
- });
- },
- // 隐藏气泡框
- hideBubble() {
- this.setData({
- show: false
- });
- }
- },
- lifetimes: {
- // 组件加载时设置初始样式
- attached() {
- const { showStyle } = this.properties;
- this.setData({
- containerStyle: showStyle.containerStyle || '',
- contentStyle: showStyle.contentStyle || ''
- });
- }
- }
- });
|